package timeutil
import "github.com/ydb-platform/ydb-go-sdk/v3/testutil/timeutil"
Index ¶
- func Now() time.Time
- func StubTestHookNewTimer(f func(time.Duration) Timer) (cleanup func())
- func StubTestHookTimeNow(now time.Time) (shifter func(time.Duration), cleanup func())
- func Until(t time.Time) time.Duration
- type Timer
Functions ¶
func Now ¶
Now returns result of time.Now() if no TestHookTimeNow set up.
func StubTestHookNewTimer ¶
StubTestHookNewTimer stubs all creation of Timers for ydb packages. It returns cleanup function that MUST be called after test execution.
NOTE: tests using this function MUST not be called concurrently.
func StubTestHookTimeNow ¶
StubTestHookTimeNow stubs all `Now()` use for ydb packages.
It sets up current time to given now time. It returns time shifter function that shifts current time by given duration. It returns cleanup function that MUST be called after test execution.
NOTE: tests using this function MUST not be called concurrently.
func Until ¶
Until returns the duration until t. It is shorthand for t.Sub(timeutil.Now()).
Types ¶
type Timer ¶
Timer is the interface used by node watcher to be periodically triggered to prepare some action.
func AfterFunc ¶
AfterFunc waits for the duration to elapse and then calls f in its own goroutine. It returns a Timer that can be used to cancel the call using its Stop method.
func NewStoppedTimer ¶
func NewStoppedTimer() Timer
NewStoppedTimer creates a new stopped Timer.
func NewTimer ¶
NewTimer creates a new Timer that will send the current time on its channel after at least duration d.
It uses time package as timer implementation.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
testutil/timeutil/timetest |
- Version
- v3.19.0
- Published
- Apr 8, 2022
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 17 minutes ago –
Tools for package owners.