Simplify Clock/ClockMark design

- Do not require initialElapsed parameter
- Introduce instead ClockMark +- Duration operators
- Do not require ClockMark to expose its originating Clock back
- Turn elapsedFrom property into elapsed() function
- Rename abstract clock classes
- Fix unit of abstract clocks when constructing them

Add top-level docs for Clocks
This commit is contained in:
Ilya Gorbunov
2019-04-15 22:27:02 +03:00
parent ca29cfb88d
commit b5d16f1a9b
5 changed files with 78 additions and 55 deletions
@@ -5,8 +5,7 @@
package kotlin.time
public actual object MonoClock : LongReadingClock(), Clock { // TODO: interface should not be required here
override fun reading(): Long = System.nanoTime()
public actual object MonoClock : AbstractLongClock(unit = DurationUnit.NANOSECONDS), Clock { // TODO: interface should not be required here
override fun read(): Long = System.nanoTime()
override fun toString(): String = "Clock(System.nanoTime())"
override val unit: DurationUnit = DurationUnit.NANOSECONDS
}