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

Replace a usage of deprecated getTimeNanos() in K/N #4238

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

qurbonzoda
Copy link
Contributor

The function was deprecated with warning in Kotlin 1.9. In Kotlin 2.1 the deprecation level will be raised to error.

See KT-71628

@qurbonzoda qurbonzoda added the kotlin-merge-blocker PRs labeled as merge-blockers are effectively preventing a corresponding merge into main Kotlin repo label Oct 3, 2024
docs/topics/cancellation-and-timeouts.md Outdated Show resolved Hide resolved
kotlinx-coroutines-core/native/src/EventLoop.kt Outdated Show resolved Hide resolved
kotlinx-coroutines-core/jvm/src/AbstractTimeSource.kt Outdated Show resolved Hide resolved
The function was deprecated with warning in Kotlin 1.9.
In Kotlin 2.1 the deprecation level will be raised to error.

See KT-71628
@qurbonzoda qurbonzoda force-pushed the qurbonzoda/fix-aggregate-build branch from 134a9c8 to 4c9ffd2 Compare October 8, 2024 07:22
@qurbonzoda qurbonzoda changed the base branch from kotlin-community/k2/dev to develop October 8, 2024 07:23
@qurbonzoda qurbonzoda changed the title Suppress a usage of deprecated getTimeNanos() in K/N Replace a usage of deprecated getTimeNanos() in K/N Oct 8, 2024
@qurbonzoda qurbonzoda merged commit 9749b8c into develop Oct 8, 2024
1 check passed
internal actual fun nanoTime(): Long = getTimeNanos()
private val startingPoint = TimeSource.Monotonic.markNow()

internal actual fun nanoTime(): Long = (TimeSource.Monotonic.markNow() - startingPoint).inWholeNanoseconds
Copy link
Member

Choose a reason for hiding this comment

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

Tip: You could use startingPoint.elapsedNow instead of subtracting marks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kotlin-merge-blocker PRs labeled as merge-blockers are effectively preventing a corresponding merge into main Kotlin repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants