diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-07 14:10:32 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-08 16:56:26 +0200 |
commit | 35c88a7f907f20652e4e55697c0c438da0c4d57d (patch) | |
tree | 0c4d5b9fc4b40e34dc59c2063d2a451b020b1cd5 /common/htime | |
parent | e77ca3c105bd64c5077d823d2127f6f812a4f681 (diff) |
Use configured timeZone for the clock
And some other related adjustments.
Updates #8787
Diffstat (limited to 'common/htime')
-rw-r--r-- | common/htime/time.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/common/htime/time.go b/common/htime/time.go index d854e9312..052a45ed1 100644 --- a/common/htime/time.go +++ b/common/htime/time.go @@ -75,7 +75,8 @@ var ( "November", "December", } - Clock = clock.Start(time.Now()) + + Clock = clock.System() ) func NewTimeFormatter(ltr locales.Translator) TimeFormatter { @@ -151,12 +152,12 @@ func ToTimeInDefaultLocationE(i any, location *time.Location) (tim time.Time, er return cast.ToTimeInDefaultLocationE(i, location) } -// Now returns time.Now() or time value based on`clock` flag. +// Now returns time.Now() or time value based on the `clock` flag. // Use this function to fake time inside hugo. func Now() time.Time { return Clock.Now() } func Since(t time.Time) time.Duration { - return Clock.Now().Sub(t) + return Clock.Since(t) } |