Create time Package for Shared/timeutil, mclock and slotutil (#9594)

* add time pkg

* Go fmt
This commit is contained in:
terence tsao
2021-09-14 17:09:04 -07:00
committed by GitHub
parent 77de467250
commit 3e71997290
115 changed files with 322 additions and 320 deletions

21
time/utils.go Normal file
View File

@@ -0,0 +1,21 @@
// Package timeutils is a wrapper around the go standard time library.
package time
import (
"time"
)
// Since returns the duration since t.
func Since(t time.Time) time.Duration {
return Now().Sub(t)
}
// Until returns the duration until t.
func Until(t time.Time) time.Duration {
return t.Sub(Now())
}
// Now returns the current local time.
func Now() time.Time {
return time.Now()
}