Skip to content

Commit

Permalink
Fix incorrect currentTime() for Android devices on API 25 and blow
Browse files Browse the repository at this point in the history
Also add millisecond precision
  • Loading branch information
stavfx authored Oct 30, 2024
1 parent df49eef commit f119dc8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public actual fun currentTime(): RealmInstant {
val jtInstant = java.time.Clock.systemUTC().instant()
RealmInstantImpl(jtInstant.epochSecond, jtInstant.nano)
} else {
RealmInstantImpl(System.currentTimeMillis(), 0)
val now = System.currentTimeMillis()
RealmInstantImpl(now / 1000, (now % 1000).toInt() * 1_000_000)
}
}

0 comments on commit f119dc8

Please sign in to comment.