Skip to content

Timestamp

Internal MongoDB timestamp used in the oplog.

Use the kotlin.time.Instant type for operations involving dates.

Constructors

Timestamp

constructor(value: ULong)
constructor(instant: Instant, counter: UInt)

Constructs a timestamp from its Timestamp.instant and Timestamp.counter components.

Types

Companion

object Companion

Serializer

@LowLevelApi



object Serializer : KSerializer<Timestamp> 

Default serializer for Timestamp.

Properties

counter

val counter: UInt

Incrementing counter.

instant

Date and time represented by this Timestamp, with a precision of one second.

A Timestamp can represent seconds between the UNIX epoch (Jan 1st 1970) and MAX_INSTANT.

value

val value: ULong

The raw value for this Timestamp.

The first four bytes are a timestamp, the last four as an increment.

Note that this value is stored in big-endian representation, whereas the BSON specification represents timestamps in little-endian. Drivers using this type are expected to invert the endianness of this number. This implementation choice allows better sorting performance.

Functions

compareTo

open operator override fun compareTo(other: Timestamp): Int

equals

open operator override fun equals(other: Any?): Boolean

hashCode

open override fun hashCode(): Int

toString

open override fun toString(): String