stored-timestamp-is-a-local-wall-clock

Installation
SKILL.md

The column holds a wall clock, not an instant

Two halves, each defensible on its own, written months apart. The producer captures the device's wall clock:

// adapted
fun now(): LocalDateTime = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault())

The ORM's converter then encodes that wall clock as if it were UTC, and decodes it the same way:

// adapted — an exact inverse of itself
@TypeConverter fun dateToTimestamp(date: LocalDateTime?): Long? =
    date?.toInstant(TimeZone.UTC)?.toEpochMilliseconds()
Installs
2
GitHub Stars
35
First Seen
6 days ago
stored-timestamp-is-a-local-wall-clock — maxrave-dev/kotlin-footguns