Source File
time.go
Belonging Package
github.com/aws/aws-sdk-go-v2/internal/sdk
package sdk
import (
)
func () {
NowTime = time.Now
Sleep = time.Sleep
SleepWithContext = sleepWithContext
}
// NowTime is a value for getting the current time. This value can be overridden
// for testing mocking out current time.
var NowTime func() time.Time
// Sleep is a value for sleeping for a duration. This value can be overridden
// for testing and mocking out sleep duration.
var Sleep func(time.Duration)
// SleepWithContext will wait for the timer duration to expire, or the context
// is canceled. Which ever happens first. If the context is canceled the Context's
// error will be returned.
//
// This value can be overridden for testing and mocking out sleep duration.
var SleepWithContext func(context.Context, time.Duration) error
// sleepWithContext will wait for the timer duration to expire, or the context
// is canceled. Which ever happens first. If the context is canceled the
// Context's error will be returned.
func ( context.Context, time.Duration) error {
:= time.NewTimer()
defer .Stop()
select {
case <-.C:
break
case <-.Done():
return .Err()
}
return nil
}
// noOpSleepWithContext does nothing, returns immediately.
func (context.Context, time.Duration) error {
return nil
}
func (time.Duration) {}
// TestingUseNopSleep is a utility for disabling sleep across the SDK for
// testing.
func () func() {
SleepWithContext = noOpSleepWithContext
Sleep = noOpSleep
return func() {
SleepWithContext = sleepWithContext
Sleep = time.Sleep
}
}
// TestingUseReferenceTime is a utility for swapping the time function across the SDK to return a specific reference time
// for testing purposes.
func ( time.Time) func() {
NowTime = func() time.Time {
return
}
return func() {
NowTime = time.Now
}
}
The pages are generated with Golds v0.4.9. (GOOS=linux GOARCH=amd64)