github.com/mailgun/holster/v4@v4.20.0/clock/provider_safe.go (about) 1 //go:build holster_test_mode 2 3 package clock 4 5 import "sync" 6 7 var ( 8 providerMu sync.RWMutex 9 provider Clock = realtime 10 ) 11 12 func setProvider(p Clock) { 13 providerMu.Lock() 14 provider = p 15 providerMu.Unlock() 16 } 17 18 func getProvider() Clock { 19 providerMu.RLock() 20 p := provider 21 providerMu.RUnlock() 22 return p 23 }