diff --git a/export_test.go b/export_test.go index 95715b5f..36b2c547 100644 --- a/export_test.go +++ b/export_test.go @@ -2,6 +2,7 @@ package redis import ( "net" + "sync" "time" ) @@ -19,12 +20,18 @@ func (cn *conn) SetNetConn(netcn net.Conn) { cn.netcn = netcn } +var timeMu sync.Mutex + func SetTime(tm time.Time) { + timeMu.Lock() now = func() time.Time { return tm } + timeMu.Unlock() } func RestoreTime() { + timeMu.Lock() now = time.Now + timeMu.Unlock() }