Add "Unix()" function to monotonic clock for "seconds-since-start".

#254.
pull/259/head
Christopher Young 2016-02-17 19:33:13 -05:00
rodzic cca7d15683
commit c165acd98e
1 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -39,6 +39,10 @@ func (m *monotonic) HumanizeTime(t time.Time) string {
return humanize.RelTime(t, m.Time, "ago", "from now")
}
func (m *monotonic) Unix() int64 {
return int64(m.Since(time.Time{}).Seconds())
}
func NewMonotonic() *monotonic {
t := &monotonic{Milliseconds: 0, Time: time.Time{}, ticker: time.NewTicker(50 * time.Millisecond)}
go t.Watcher()