github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/mtime/mtime.go (about) 1 package mtime 2 3 import "time" 4 5 // Now returns the current time. 6 var Now = func() time.Time { return time.Now() } 7 8 // NowForce sets the time returned by Now to t. 9 func NowForce(t time.Time) { 10 Now = func() time.Time { return t } 11 } 12 13 // NowReset makes Now returns the current time again. 14 func NowReset() { 15 Now = func() time.Time { return time.Now() } 16 }