Augments

  • TimestampGenerator

Constructor

new

MonotonicTimestampGenerator

([Number warningThreshold], [Number minLogInterval])

A timestamp generator that guarantees monotonically increasing timestamps and logs warnings when timestamps drift in the future.

Date has millisecond precision and client timestamps require microsecond precision. This generator keeps track of the last generated timestamp, and if the current time is within the same millisecond as the last, it fills the microsecond portion of the new timestamp with the value of an incrementing counter.

Parameters:
Name Type Description
warningThreshold optional Number

Determines how far in the future timestamps are allowed to drift before a warning is logged, expressed in milliseconds. Default: 1000.

minLogInterval optional Number

In case of multiple log events, it determines the time separation between log events, expressed in milliseconds. Use 0 to disable. Default: 1000.

Methods

getDate

()

Returns the current time in milliseconds since UNIX epoch

Returns:
Type Description
Number