Alexander Udalov
795d6ab407
Migrate UseExperimental->OptIn in project sources
2020-03-10 12:07:14 +01:00
Ilya Gorbunov
1336da8453
Rename Clock to TimeSource, ClockMark to TimeMark
...
Step 2: rename classes and interfaces.
Provide deprecated typealiases to smooth migration.
2020-01-21 03:28:35 +03:00
Ilya Gorbunov
a985402507
Introduce ClockMark.hasPassedNow, hasNotPassedNow functions
...
Makes it more clear to use them than comparing elapsed with Duration.ZERO.
2019-08-16 15:29:16 +03:00
Ilya Gorbunov
44195d436e
Rename: Clock.markNow, ClockMark.elapsedNow
...
Add "Now" suffix to the names of functions that depend on the current
time moment.
2019-08-16 15:29:16 +03:00
Ilya Gorbunov
f889d25287
Introduce TestClock.plusAssign(Duration) and hide implementation details
...
TestClock.plusAssign(Duration) is for advancing TestClock time.
Hide reading value, do not allow to provide initial reading,
fix clock unit to nanoseconds at construction time.
2019-08-16 15:28:45 +03:00
Ilya Gorbunov
4de9361c37
Introduce Duration.isPositive method
2019-08-16 15:25:57 +03:00
Ilya Gorbunov
d7252548fc
Add symmetric number * duration operators
2019-06-18 19:49:50 +03:00
Ilya Gorbunov
a2b1c537af
Change Duration.toString scientific exponent formatting
...
- use 'e+' for positive exponents in scientific format
2019-06-18 19:49:35 +03:00
Ilya Gorbunov
a5b7c270ae
Change Duration.toString(unit, decimals) formatting
...
- switch to scientific notation when value is too big (greater than 1e14)
- allow at most 12 decimals, larger values are coerced to 12
- use scientific format with exactly two decimals in mantissa in JVM
2019-06-18 19:49:35 +03:00
Ilya Gorbunov
c66740a7ed
Explicit public visibility, SinceKotlin and ExperimentalTime status
...
Use file level ExperimentalTime opt-in in tests.
2019-06-18 04:02:35 +03:00
Ilya Gorbunov
3b989cc815
Avoid using 'D' component in ISO duration string representation
...
Days in ISO have nominal duration, they are not always equal to 24H
2019-06-18 04:02:34 +03:00
Ilya Gorbunov
368452748b
Move convertDurationUnit into Duration companion
2019-06-18 04:02:33 +03:00
Ilya Gorbunov
ca10d13f34
Rename Duration storage property to 'value'
2019-06-18 04:02:33 +03:00
Ilya Gorbunov
365cbb94cd
Change Duration.absoluteValue to property
2019-06-18 04:02:33 +03:00
Ilya Gorbunov
3f7a0d0845
Rename DurationMeasured to TimedValue, withMeasureTime to measuredTimeValue
...
Add measureTime docs
2019-06-18 04:02:33 +03:00
Ilya Gorbunov
9deac2a591
Rename withComponents to toComponents and add two overloads of them
2019-06-18 04:02:33 +03:00
Ilya Gorbunov
796ad29637
Add shortcuts to convert duration to milliseconds and nanoseconds
2019-06-18 04:02:32 +03:00
Ilya Gorbunov
8004c34e44
Reduce Duration API surface, add top-level docs
...
- toDuration(unit) extension instead of constructors
- toDouble/Long/Int(unit) function instead of inUnits()
- remove static factory functions
- remove MIN_VALUE/MAX_VALUE constants
2019-06-18 04:02:32 +03:00
Ilya Gorbunov
682430766b
Add ClockMark and measureTime tests with test clock
2019-06-18 04:02:32 +03:00
Ilya Gorbunov
ca29cfb88d
Implement MonoClock in JS
...
It uses either process.hrtime() in node.js or performance.now() in browser,
falling back to Date.now() if the latter is not available
2019-06-18 04:02:31 +03:00
Ilya Gorbunov
b816f50d4d
Implement and test default string formatting in JVM and JS
...
Relax Duration.toString tests for JS and Native rounding specifics
2019-06-18 04:01:55 +03:00
Ilya Gorbunov
c1f7fd0281
Duration: test toString in particular units
2019-06-18 03:59:52 +03:00
Ilya Gorbunov
b9c56af9ba
Change Duration value storage unit to ns
2019-06-18 03:59:52 +03:00
Ilya Gorbunov
690049c082
Duration unit tests
2019-06-18 03:59:52 +03:00
Ilya Gorbunov
7977b6cdb8
Implement DurationUnit in JS, add doc summary and conversion test
2019-06-18 03:59:51 +03:00