mirror of
https://codeberg.org/cunicu/cunicu.git
synced 2025-09-26 21:01:14 +08:00
22 lines
368 B
Go
22 lines
368 B
Go
// SPDX-FileCopyrightText: 2025 Steffen Vogel <post@steffenvogel.de>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package backoff
|
|
|
|
import "time"
|
|
|
|
type Clock interface {
|
|
Sleep(duration time.Duration)
|
|
Now() time.Time
|
|
}
|
|
|
|
type systemClock struct{}
|
|
|
|
func (c *systemClock) Sleep(d time.Duration) {
|
|
time.Sleep(d)
|
|
}
|
|
|
|
func (c *systemClock) Now() time.Time {
|
|
return time.Now()
|
|
}
|