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