remove unnecessary utils.kt

This commit is contained in:
Alexander Nozik 2021-01-28 12:37:43 +03:00
parent 5829c12372
commit edcc3e4956
2 changed files with 8 additions and 13 deletions

View File

@ -115,11 +115,16 @@ internal class ProtoNumassPoint(
public class ProtoBlock( public class ProtoBlock(
override val channel: Int, override val channel: Int,
private val block: Point.Channel.Block, private val block: Point.Channel.Block,
public val parent: NumassPoint? = null, parent: NumassPoint? = null,
) : NumassBlock { ) : NumassBlock {
override val startTime: Instant 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 { override val length: Duration = when {
block.length > 0 -> Duration.ofNanos(block.length) block.length > 0 -> Duration.ofNanos(block.length)
@ -150,7 +155,7 @@ public class ProtoBlock(
}.asFlow() }.asFlow()
} else { } else {
emptyFlow<NumassEvent>() emptyFlow()
} }

View File

@ -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())
}