mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 14:21:14 +00:00
This is a very minor change, but I was looking through the code, and this seems like it shouldn't be exported or used more broadly, so I've moved it out.
18 lines
423 B
Go
18 lines
423 B
Go
package time
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Now returns the current time in UTC with no monotonic component.
|
|
func Now() time.Time {
|
|
return Canonical(time.Now())
|
|
}
|
|
|
|
// Canonical returns UTC time with no monotonic component.
|
|
// Stripping the monotonic component is for time equality.
|
|
// See https://github.com/tendermint/tendermint/pull/2203#discussion_r215064334
|
|
func Canonical(t time.Time) time.Time {
|
|
return t.Round(0).UTC()
|
|
}
|