github.com/prysmaticlabs/prysm@v1.4.4/shared/timeutils/utils.go (about)

     1  // Package timeutils is a wrapper around the go standard time library.
     2  package timeutils
     3  
     4  import (
     5  	"time"
     6  )
     7  
     8  // Since returns the duration since t.
     9  func Since(t time.Time) time.Duration {
    10  	return Now().Sub(t)
    11  }
    12  
    13  // Until returns the duration until t.
    14  func Until(t time.Time) time.Duration {
    15  	return t.Sub(Now())
    16  }
    17  
    18  // Now returns the current local time.
    19  func Now() time.Time {
    20  	return time.Now()
    21  }