Kotlin / kotlinx-datetime

KotlinX multiplatform date/time library
Apache License 2.0
2.43k stars 102 forks source link

Consider moving `Instant` and `Clock` to the standard library #382

Open dkhalanskyjb opened 7 months ago

dkhalanskyjb commented 7 months ago

Obtaining the current instant is often needed, as is doing some Duration-based operations on it. Instant is useful even when the rest of the library isn't: you don't need the timezone functionality to log human-readable timestamps (https://github.com/Kotlin/kotlinx-datetime/issues/121#issuecomment-877895270) or represent file access and modification times (okio), or sort events, etc.

With this change, the kotlinx-datetime library would provide calendar- and timezone-aware operations, whereas Instant, Duration, Clock, and TimeSource would work with just "the flow of time" as seen by the computer.