2021-09-22 22:38:06 +00:00
|
|
|
// Package time is a wrapper around the go standard time library.
|
2021-09-15 00:09:04 +00:00
|
|
|
package time
|
2019-08-09 14:05:08 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2020-09-22 05:47:01 +00:00
|
|
|
// Since returns the duration since t.
|
2019-08-09 14:05:08 +00:00
|
|
|
func Since(t time.Time) time.Duration {
|
2019-08-13 17:59:11 +00:00
|
|
|
return Now().Sub(t)
|
2019-08-09 14:05:08 +00:00
|
|
|
}
|
|
|
|
|
2020-09-22 05:47:01 +00:00
|
|
|
// Until returns the duration until t.
|
2019-08-09 14:05:08 +00:00
|
|
|
func Until(t time.Time) time.Duration {
|
2019-08-13 17:59:11 +00:00
|
|
|
return t.Sub(Now())
|
|
|
|
}
|
|
|
|
|
2020-09-22 05:47:01 +00:00
|
|
|
// Now returns the current local time.
|
2019-08-13 17:59:11 +00:00
|
|
|
func Now() time.Time {
|
2020-08-14 19:22:58 +00:00
|
|
|
return time.Now()
|
2019-08-09 14:05:08 +00:00
|
|
|
}
|