Package mtime contains a millisecond representation of time. The purpose of this representation is alignment with the Beam specification, where we need extreme values outside the range of time.Time for windowing.
Time is the number of milli-seconds since the Unix epoch. The valid range of times is bounded by what can be represented a _micro_-seconds-since-epoch.
const ( // MinTimestamp is the minimum value for any Beam timestamp. Often referred to // as "-infinity". This value and MaxTimestamp are chosen so that their // microseconds-since-epoch can be safely represented with an int64 and boundary // values can be represented correctly with millisecond precision. MinTimestamp Time = math.MinInt64 / 1000 // MaxTimestamp is the maximum value for any Beam timestamp. Often referred to // as "+infinity". MaxTimestamp Time = math.MaxInt64 / 1000 // EndOfGlobalWindowTime is the timestamp at the end of the global window. It // is a day before the max timestamp. // TODO Use GLOBAL_WINDOW_MAX_TIMESTAMP_MILLIS from the Runner API constants EndOfGlobalWindowTime = MaxTimestamp - 24*60*60*1000 // ZeroTimestamp is the default zero value time. It corresponds to the unix epoch. ZeroTimestamp Time = 0 )
FromDuration returns a timestamp from a time.Duration-since-epoch value.
FromMilliseconds returns a timestamp from a raw milliseconds-since-epoch value.
FromTime returns a milli-second precision timestamp from a time.Time.
Max returns the largest (latest) time.
Min returns the smallest (earliest) time.
Normalize ensures a Time is within [MinTimestamp,MaxTimestamp].
Now returns the current time.
Add returns the time plus the duration.
Milliseconds returns the number of milli-seconds since the Unix epoch.
Subtract returns the time minus the duration.