Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Kotlin to 1.6.0 and remove ExperimentalTime #161

Merged
merged 3 commits into from
Dec 13, 2021
Merged

Conversation

dkhalanskyjb
Copy link
Collaborator

@dkhalanskyjb dkhalanskyjb commented Dec 10, 2021

Fixes #156
Supersedes #159

core/common/test/LocalDateTimeTest.kt Outdated Show resolved Hide resolved
@@ -43,8 +44,8 @@ public actual class Instant internal constructor(internal val value: jtInstant)
public actual operator fun minus(duration: Duration): Instant = plus(-duration)

public actual operator fun minus(other: Instant): Duration =
Duration.seconds(this.value.epochSecond - other.value.epochSecond) + // won't overflow given the instant bounds
Duration.nanoseconds(this.value.nano - other.value.nano)
(this.value.epochSecond - other.value.epochSecond).seconds + // won't overflow given the instant bounds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: I'd probably use in such cases a more verbose .toDuration(DurationUnit.SECONDS) to sound less tautological.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried this and didn't like the result, looked to me as much more cumbersome than both Duration.seconds(...) and .seconds, so the intent is obscured. .seconds is not pretty, but very obvious.

@dkhalanskyjb dkhalanskyjb merged commit 4895b49 into master Dec 13, 2021
@dkhalanskyjb dkhalanskyjb deleted the pr/159 branch December 13, 2021 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove experimental opt in for durations (for kotlin 1.6)
3 participants