Documentation ¶
Index ¶
- func Since(t Time) time.Duration
- type Time
- func (t Time) Add(d time.Duration) Time
- func (t Time) After(u Time) bool
- func (t Time) Before(u Time) bool
- func (t Time) Clock() (hour, min, sec int)
- func (t Time) Date() (year int, month time.Month, day int)
- func (t Time) IsZero() bool
- func (t Time) Millisecond() int
- func (t Time) String() string
- func (t Time) Sub(u Time) time.Duration
- func (t Time) ToNativeTime() time.Time
- func (t Time) UnixMilliseconds() int64
- func (t Time) UnixSeconds() int64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time is a wrapper for time.Time that guarantees all of its methods will return a millisecond precisioned times.
func UnixMilliseconds ¶
UnixMilliseconds returns the local Time corresponding to the given Unix time, ms milliseconds since January 1, 1970 UTC.
func (Time) Add ¶
Add returns the time t+d. It panics if d has a precision greater than one millisecond (the duration has a non zero microseconds part).
func (Time) IsZero ¶
IsZero reports whether t represents the zero time instant, January 1, year 1, 00:00:00 UTC.
func (Time) Millisecond ¶
Millisecond returns the millisecond offset within the second specified by t, in the range [0, 999].
func (Time) String ¶
String returns the time formatted using the format string
"2006-01-02 15:04:05.999999999 -0700 MST"
func (Time) Sub ¶
Sub returns the duration t-u. If the result exceeds the maximum (or minimum) value that can be stored in a Duration, the maximum (or minimum) duration will be returned. To compute t-d for a duration d, use t.Add(-d).
func (Time) ToNativeTime ¶
ToNativeTime converts t to time.Time
func (Time) UnixMilliseconds ¶
UnixMilliseconds returns t as a Unix time, the number of milliseconds elapsed since January 1, 1970 UTC.
func (Time) UnixSeconds ¶
UnixSeconds returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC.