timeprovider

package
v0.12.0-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Now

func Now() *metav1.Time

func TimeoutReached

func TimeoutReached(previous, current *metav1.Time, timeout time.Duration) bool

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

The purpose if the Provider is to have a non-moving resp. fakable now for testing.

func New

func New() *Provider

func (*Provider) IsOutdated

func (timeProvider *Provider) IsOutdated(previous *metav1.Time, timeout time.Duration) bool

func (*Provider) Now

func (timeProvider *Provider) Now() *metav1.Time

Warning: This method should be never called twice on the same instance in production code where you need an accurate "now" timestamp, because it returns the same timestamp on each call, even if the stored "now" is hours in the past

func (*Provider) SetNow

func (timeProvider *Provider) SetNow(now *metav1.Time)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL