chore(repo): reinitialize repository
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package timeutil
|
||||
|
||||
import "time"
|
||||
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
}
|
||||
|
||||
type SystemClock struct{}
|
||||
|
||||
func (SystemClock) Now() time.Time {
|
||||
return time.Now().UTC()
|
||||
}
|
||||
|
||||
type FixedClock struct {
|
||||
Time time.Time
|
||||
}
|
||||
|
||||
func (c FixedClock) Now() time.Time {
|
||||
return c.Time.UTC()
|
||||
}
|
||||
|
||||
func NowUTC() time.Time {
|
||||
return time.Now().UTC()
|
||||
}
|
||||
|
||||
func FormatRFC3339(t time.Time) string {
|
||||
return t.UTC().Format(time.RFC3339)
|
||||
}
|
||||
|
||||
func FormatRFC3339Nano(t time.Time) string {
|
||||
return t.UTC().Format(time.RFC3339Nano)
|
||||
}
|
||||
|
||||
func TimestampIDPart(t time.Time) string {
|
||||
return t.UTC().Format("20060102T150405Z")
|
||||
}
|
||||
Reference in New Issue
Block a user