20 lines
326 B
Go
20 lines
326 B
Go
package throttling
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type testClock struct {
|
|
now time.Time
|
|
}
|
|
|
|
func (t *testClock) time() time.Time {
|
|
return t.now
|
|
}
|
|
|
|
// Set this value to obtain a new value for the current time.
|
|
// This allows testing various scenario's with timing.
|
|
//
|
|
// Simply: currentTime.now = ....
|
|
var currentTime = &testClock{}
|