diff --git a/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/ProtoNumassPoint.kt b/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/ProtoNumassPoint.kt index eaaa1f7..781666e 100644 --- a/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/ProtoNumassPoint.kt +++ b/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/ProtoNumassPoint.kt @@ -115,11 +115,16 @@ internal class ProtoNumassPoint( public class ProtoBlock( override val channel: Int, private val block: Point.Channel.Block, - public val parent: NumassPoint? = null, + parent: NumassPoint? = null, ) : NumassBlock { override val startTime: Instant - get() = epochNanoTime(block.time) + get(){ + val nanos = block.time + val seconds = Math.floorDiv(nanos, 1e9.toInt().toLong()) + val reminder = (nanos % 1e9).toInt() + return Instant.ofEpochSecond(seconds, reminder.toLong()) + } override val length: Duration = when { block.length > 0 -> Duration.ofNanos(block.length) @@ -150,7 +155,7 @@ public class ProtoBlock( }.asFlow() } else { - emptyFlow() + emptyFlow() } diff --git a/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/utils.kt b/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/utils.kt deleted file mode 100644 index 49c7609..0000000 --- a/numass-data-proto/src/main/kotlin/ru/inr/mass/data/proto/utils.kt +++ /dev/null @@ -1,10 +0,0 @@ -package ru.inr.mass.data.proto - -import java.time.Instant - - -internal fun epochNanoTime(nanos: Long): Instant { - val seconds = Math.floorDiv(nanos, 1e9.toInt().toLong()) - val reminder = (nanos % 1e9).toInt() - return Instant.ofEpochSecond(seconds, reminder.toLong()) -} \ No newline at end of file