mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Create time Package for Shared/timeutil, mclock and slotutil (#9594)
* add time pkg * Go fmt
This commit is contained in:
21
time/utils.go
Normal file
21
time/utils.go
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user