Skip to content

Commit 6080b22

Browse files
committed
fix not updating timeCache
Thanks to @tacerus for pointing this out in #20. Closed #20
1 parent 1ffa3f9 commit 6080b22

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

time.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ func (tc *timeCache) Now() realTime.Time {
1515
return *tc.p.Load()
1616
}
1717

18-
var tc = func() (tc timeCache) {
18+
var tc = func() *timeCache {
19+
var tc timeCache
20+
1921
refresh := func() {
2022
n := realTime.Now()
2123
tc.p.Store(&n)
@@ -30,5 +32,5 @@ var tc = func() (tc timeCache) {
3032

3133
refresh()
3234
go refresher()
33-
return
35+
return &tc
3436
}()

0 commit comments

Comments
 (0)