Discover Packages
github.com/igalarzab/amazon-vpc-cni-k8s
pkg
utils
ttime
package
Version:
v1.0.0
Opens a new window with list of versions in this module.
Published: Jun 3, 2018
License: Apache-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation Source Files Directories Overview Index Constants Variables Functions Types Now() SetTime(t) Since(t) type DefaultTime type Time type Timer After(d) AfterFunc(d, f) Now() Sleep(d)
Documentation
¶
Package ttime implements a testable alternative to the Go "time" package.
Now returns the implementation's current time
SetTime configures what 'Time' implementation to use for each of the
package-level methods.
func Since (t time.Time) time.Duration
Since returns the time different from Now and the given time t
type DefaultTime struct {}
DefaultTime is a Time that behaves normally
func (*DefaultTime) After(d time.Duration) <-chan time.Time
After sleeps for the given duration and then writes to to the returned channel
func (*DefaultTime) AfterFunc(d time.Duration, f func () ) Timer
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 (*DefaultTime) Now() time.Time
Now returns the current time
func (*DefaultTime) Sleep(d time.Duration)
Sleep sleeps for the given duration
type Time interface {
Now() time.Time
Sleep(d time.Duration)
After(d time.Duration) <-chan time.Time
AfterFunc(d time.Duration, f func () ) Timer
}
Time represents an implementation for this package's methods
type Timer interface {
Reset(d time.Duration) bool
Stop() bool
}
Source Files
¶
Directories
¶
Show internal
Collapse all
Package mock_ttime is a generated GoMock package.
Package mock_ttime is a generated GoMock package.
Click to show internal directories.
Click to hide internal directories.