diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index df25333..bc09ab3 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -7,7 +7,7 @@ fun main() = runBlocking{ GlobalScope.launch { val mqtt = MqttSubscriber() mqtt.connect() - val waitTime = System.getenv("WAITTIME").toLong() ?: 10000L + val waitTime = System.getenv("WAITTIME").toLong() delay(waitTime) val resultMap = mqtt.disconnect() val resultProcessor = ProcessResults() diff --git a/src/main/kotlin/ProcessResults.kt b/src/main/kotlin/ProcessResults.kt index c3ca538..9858152 100644 --- a/src/main/kotlin/ProcessResults.kt +++ b/src/main/kotlin/ProcessResults.kt @@ -1,14 +1,18 @@ import java.text.SimpleDateFormat import java.time.Instant +import java.time.ZoneId +import java.time.format.DateTimeFormatter -class ProcessResults{ +class ProcessResults { var mapToProcess = LinkedHashMap() - private var formatter = SimpleDateFormat("yyyy-MM-dd_HH-mm-ss_SSS") + private var formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss_SSS") + .withZone(ZoneId.systemDefault()) - fun process(){ - for((id, instant) in this.mapToProcess){ + fun process() { + println("Start processing results") + for ((id, instant) in this.mapToProcess) { val currInstantString = formatter.format(instant) println("$id, $currInstantString") }