new MonotonicTimestampGenerator(warningThresholdopt, minLogIntervalopt)
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 | Attributes | Description |
---|---|---|---|
warningThreshold |
Number |
<optional> |
Determines how far in the future timestamps are allowed to drift before a
warning is logged, expressed in milliseconds. Default: |
minLogInterval |
Number |
<optional> |
In case of multiple log events, it determines the time separation between log
events, expressed in milliseconds. Use 0 to disable. Default: |
- Source:
Extends
- TimestampGenerator
Methods
getDate() → {Number}
Returns the current time in milliseconds since UNIX epoch
- Source:
Returns:
- Type
- Number