package clock import "time" // Instant is a UTC point represented as Unix milliseconds. type Instant int64 func (i Instant) Valid() bool { return i > 0 } func NowInstant() Instant { return FromTime(time.Now().UTC()) } func FromTime(value time.Time) Instant { return Instant(value.UTC().UnixMilli()) } func (i Instant) Time() time.Time { return time.UnixMilli(int64(i)).UTC() }