RealmInstant

A representation of a Realm timestamp. A timestamp represent a single point in time defined as the distance from the UNIX epoch: 00:00:00 UTC on 1 January 1970, expressed in seconds and nanoseconds.

Specifically, this means that all timestamps after the epoch consist of positive numbers and all timestamps before the epoch consists of the negative numbers.

Examples:

  • The UNIX epoch is constructed by RealmInstant.from(0, 0).

  • Relative times are constructed as follows:

    • +1 second is constructed by RealmInstant.from(1, 0)

    • +1 nanosecond is constructed by RealmInstant.from(0, 1)

    • +1.1 seconds (1100 milliseconds after the epoch) is constructed by RealmInstant.from(1, 100000000)

    • -1.1 seconds (1100 milliseconds before the epoch) is constructed by RealmInstant.from(-1, -100000000)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val epochSeconds: Long

The number of seconds from the epoch 1970-01-01T00:00:00Z rounded down to a Long number.

Link copied to clipboard
abstract val nanosecondsOfSecond: Int

The number of nanoseconds by which this instant is different than epochSeconds.

Functions

Link copied to clipboard
abstract operator fun compareTo(other: RealmInstant): Int