Documentation
¶
Overview ¶
Package clock provides primitives for mocking time.
Package clock provides interfaces and primitives for clocks and time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface { // After waits for the duration to elapse and then sends the current time on the returned channel. After(duration time.Duration) <-chan time.Time // AfterFunc waits for the duration to elapse and then calls the function f given to it. AfterFunc(d time.Duration, f func()) Timer // NewTicker returns a new Ticker. NewTicker(d time.Duration) Ticker // Now returns the current local time. Now() time.Time // NowProto returns a new Protobuf timestamp representing the current local time. NowProto() *timestamppb.Timestamp // Since returns the time elapsed since t. Since(t time.Time) time.Duration // Sleep pauses the current goroutine for at least the duration d. // A negative or zero duration causes Sleep to return immediately. Sleep(d time.Duration) }
Clock provides capabilities from the time standard library package.
type Ticker ¶
type Ticker interface { // C returns the channel on which the ticks are delivered. C() <-chan time.Time // Stop the Ticker. Stop() // Reset stops the trigger and next trigger will after the newly given duration has passed. Reset(duration time.Duration) }
Ticker wraps the time.Ticker class.
Directories
¶
Path | Synopsis |
---|---|
Package externalclock provides a clock implementation for external time sources.
|
Package externalclock provides a clock implementation for external time sources. |
Package systemclock provides a clock implementation for the system clock.
|
Package systemclock provides a clock implementation for the system clock. |
Click to show internal directories.
Click to hide internal directories.