File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,11 @@ public fun Clock.todayIn(timeZone: TimeZone): LocalDate =
7878 * Please only use this conversion function on the [Clock] instances that are fully controlled programmatically.
7979 */
8080@ExperimentalTime
81+ @Deprecated(" This function is deprecated because Clock.System.asTimeSource " +
82+ " can be confused with TimeSource.Monotonic, which are very different. " +
83+ " See https://github.com/Kotlin/kotlinx-datetime/issues/372" , level = DeprecationLevel .WARNING )
8184public fun Clock.asTimeSource (): TimeSource .WithComparableMarks = object : TimeSource .WithComparableMarks {
85+ @ExperimentalTime
8286 override fun markNow (): ComparableTimeMark = InstantTimeMark (now(), this @asTimeSource)
8387}
8488
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import kotlin.time.Duration.Companion.nanoseconds
1313import kotlin.time.Duration.Companion.seconds
1414
1515@OptIn(ExperimentalTime ::class )
16+ @Suppress(" DEPRECATION" )
1617class ClockTimeSourceTest {
1718 @Test
1819 fun arithmetic () {
You can’t perform that action at this time.
0 commit comments