-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Suppress a usage of deprecated getTimeNanos() in K/N #4238
base: kotlin-community/k2/dev
Are you sure you want to change the base?
Conversation
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
@@ -26,5 +26,5 @@ internal class EventLoopImpl: EventLoopImplBase() { | |||
|
|||
internal actual fun createEventLoop(): EventLoop = EventLoopImpl() | |||
|
|||
@Suppress("DEPRECATION") | |||
@Suppress("DEPRECATION_ERROR") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change can be merged to develop if we suppress both DEPRECATION
and DEPRECATION_ERROR
.
But, it would seem weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace it with the proposed replacement instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also underscores the need to refactor the usages of nanoTime()
to use the Duration API instead. Having the kotlinx-datetime Clock
and Instant
in stdlib would simplify this migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace it with the proposed replacement instead?
There is not direct replacement for the getTime
currently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to leave getTimeX
deprecated with warning until a more direct replacement is introduced, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither Clock
nor Instant
would be monotonic, though.
Maybe make the actualization on more granular groups of targets (linux, macos, mingw, androidNative) and invoke OS-level APIs to get the monotonic nano time. They're all just one- or two-liners.
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