Vsevolod Tolstopyatov
175cf5e833
KT-53327 replace Enum.values() with Enum.entries in CharCategory
...
Also, replace it in stdlib tests where appropriate and disable already unsupported legacy JS tests
^KT-53327 fixed
Co-authored-by: Artem Kobzar <Artem.Kobzar@jetbrains.com >
Merge-request: KT-MR-10632
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com >
2023-06-21 14:40:16 +00:00
Abduqodiri Qurbonzoda
4ae19b2b44
[K/N] Deprecate SharedImmutable annotation #KT-57837
...
As a part of efforts to stabilize Native stdlib.
2023-06-19 11:35:32 +00:00
Ilya Gorbunov
17d977977c
KT-58058 Duration truncation internal helper function
2023-04-18 15:25:30 +00:00
Vsevolod Tolstopyatov
0c8b31b9ed
Clarify specification of Duration.parseIsoString
...
KT-52778
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com >
Merge-request: KT-MR-6556
Merged-by: Vsevolod Tolstopyatov <vsevolod.tolstopyatov@jetbrains.com >
2022-06-28 07:43:33 +00:00
Ilya Gorbunov
04d70162d2
Make DurationUnit not a typealias of TimeUnit on JVM
...
Provide conversion functions between DurationUnit and TimeUnit
2021-09-30 14:31:54 +00:00
Ilya Gorbunov
21a9198fff
Bring back Duration construction extensions KT-46229
...
Return the extension properties for constructing Duration from numbers,
but this time place them in Duration.Companion rather than on top-level.
- provide the new set of construction extension properties
in companion of Duration
- leave top-level extension properties experimental,
increase their deprecation level to ERROR,
propose the extension properties in companion instead.
- leave Duration companion static factory functions experimental,
deprecate them and propose the extension properties in companion instead.
2021-09-24 16:17:53 +00:00
Ilya Gorbunov
96611de344
Stabilize Duration, DurationUnit and related top-level functions KT-46784
...
Co-authored-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com >
2021-09-24 16:17:53 +00:00
Ilya Gorbunov
fbc43cbebe
Duration.toComponents: change the highest component type to Long
2021-09-02 02:44:16 +00:00
Ilya Gorbunov
5072653957
Duration: parse explicit positive values parenthesized
2021-07-12 04:39:28 +00:00
Ilya Gorbunov
682cb8e34a
Duration default toString: use 0, 1, 2, 3, 6, or 9 decimal digits
...
KT-42851
2021-07-12 04:39:27 +00:00
Ilya Gorbunov
0427eec20f
Quote invalid strings in exception messages
2021-07-12 04:39:26 +00:00
Ilya Gorbunov
3f6e2be687
Duration: do not use scientific format for large values
...
The largest duration value formatted in ns with maximal decimals
would fit in 40 chars.
2021-07-12 04:39:25 +00:00
Ilya Gorbunov
1be1e5279c
Duration: parse and format negative values parenthesized
2021-07-12 04:39:25 +00:00
Ilya Gorbunov
ca1a9e4ca3
Duration: longer than long values in ISO components, test negative cases
2021-07-12 04:39:24 +00:00
Ilya Gorbunov
1c6ab08220
Introduce functions to parse a duration from a string KT-45325
2021-07-12 04:39:23 +00:00
Ilya Gorbunov
7ab6f6c9b2
Change Duration.INFINITE.toIsoString representation
2021-07-12 04:39:23 +00:00
Ilya Gorbunov
ae3d9cc3cd
Small durations are formatted with sub-second units KT-42851
2021-07-12 04:39:22 +00:00
Ilya Gorbunov
150ce812f1
Use days component in the default duration format KT-42851
2021-07-12 04:39:21 +00:00
Ilya Gorbunov
255c4b405e
Duration: round Double value to Long ns instead of truncating it KT-47675
2021-07-12 04:39:21 +00:00
Ilya Gorbunov
42cd2e65e6
Change Duration.toString format KT-42851
2021-07-12 04:39:20 +00:00
Ilya Gorbunov
0e93924ff3
Duration: inWholeUnits properties instead of inUnits
...
Introduce conversion properties returning Long values,
deprecate the old ones returning Doubles.
2021-04-02 17:44:10 +03:00
Ilya Gorbunov
11d15f3343
Make Duration storage ranges symmetric and non-overlapping
...
Increase accuracy of multiplication and division.
2021-04-02 17:44:10 +03:00
Ilya Gorbunov
fa7460ba48
Store Duration value as a multi-range Long
...
Now precision loss happens at bigger durations.
This changes the binary API due different underlying type of Duration.
2021-04-02 17:43:20 +03:00
Ilya Gorbunov
a7fda66fa1
Suggest duration static factories instead of number extension properties
...
Introduce Duration companion functions to convert numbers to Duration.
Deprecate number extension properties and propose to use these
new functions instead.
2021-03-10 13:23:32 +03:00
Ilya Gorbunov
3c37bbaf64
Duration: normalize to avoid negative zeroes (KT-44168)
...
The current comparison method of inline classes makes
durations of positive and negative zeroes non-equal.
To avoid that, normalize the duration value upon construction
preventing negative zero being stored.
2020-12-31 19:44:39 +03:00
Ilya Gorbunov
ae6f10df3b
Duration: reject NaN duration values (KT-44168)
2020-12-31 19:44:10 +03:00
Svyatoslav Scherbina
0f4173cdfa
Fix running stdlib tests in worker on Native
...
Add `@SharedImmutable` or `@ThreadLocal` where required.
2020-12-14 19:03:06 +03:00
Alexander Udalov
795d6ab407
Migrate UseExperimental->OptIn in project sources
2020-03-10 12:07:14 +01: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
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
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