You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
423 B

  1. package time
  2. import (
  3. "time"
  4. )
  5. // Now returns the current time in UTC with no monotonic component.
  6. func Now() time.Time {
  7. return Canonical(time.Now())
  8. }
  9. // Canonical returns UTC time with no monotonic component.
  10. // Stripping the monotonic component is for time equality.
  11. // See https://github.com/tendermint/tendermint/pull/2203#discussion_r215064334
  12. func Canonical(t time.Time) time.Time {
  13. return t.Round(0).UTC()
  14. }