efemoney
04/14/2025, 4:51 PMAbstractLongTimeSource
(https://github.com/JetBrains/kotlin/blob/c56893d9c2c9be51df78acf98e6b6984b10407c5/libraries/stdlib/src/kotlin/time/TimeSources.kt#L28) & AbstractDoubleTimeSource
be able to provide TimeMark
s for _reading_s done outside of the time source.
This is useful if you already have some readings you want to convert into time marks to be able to easily do duration calculations or interface with some other system that did those readings already.
For example
object UptimeMillisSource : AbstractLongTimeSource {
override fun read() = SystemClock.uptimeMillis()
}
If I already have readings of SystemClock.uptimeMillis()
from another system, I should be able to call:
UptimeMillisSource.[ timeMarkOf | readingOf | readingToTimeMark | convert ](some: Long): TimeMark
Any thoughts or I go ahead & submit a PR?jw
04/14/2025, 8:40 PMefemoney
04/15/2025, 6:16 AM