scoop:scoop.std:0.1.0
src/time/instant_milliseconds.scoop
Selected production source · src/time/instant_milliseconds.scoop
1
package scoop.time3
internal fun instantMilliseconds(seconds: Long, nanos: Int): Long {4
val fraction = (nanos / 1000000).toLong()5
if (seconds < -9223372036854776L || seconds > 9223372036854775L ||6
(seconds == -9223372036854776L && fraction < 192L) ||7
(seconds == 9223372036854775L && fraction > 807L)) throw ArithmeticException()8
return if (seconds < 0L) (seconds + 1L) * 1000L - (1000L - fraction) else seconds * 1000L + fraction9
}