ktime

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Clock is used to mock time.Now() for tests.
	// Use Clock.Now() instead of time.Now() whenever needed.
	Clock clock.PassiveClock = clock.RealClock{}
)

Functions

func IsTimeSetAndEarlier

func IsTimeSetAndEarlier(ts *metav1.Time) bool

IsTimeSetAndEarlier returns true if the given *metav1.Time is set and earlier than the current time. Useful to validate timestamp updates which cannot be extended.

func IsTimeSetAndEarlierOrEqual added in v0.2.0

func IsTimeSetAndEarlierOrEqual(ts *metav1.Time) bool

IsTimeSetAndEarlierOrEqual returns true if the given *metav1.Time is set and earlier than or equal to the current time. Useful to validate timestamp updates which cannot be extended.

func IsTimeSetAndEarlierThan

func IsTimeSetAndEarlierThan(ts *metav1.Time, other time.Time) bool

IsTimeSetAndEarlierThan returns true if the given *metav1.Time is set and earlier than the other time.Time. Useful to validate timestamp updates which cannot be extended.

func IsTimeSetAndEarlierThanOrEqualTo

func IsTimeSetAndEarlierThanOrEqualTo(ts *metav1.Time, other time.Time) bool

IsTimeSetAndEarlierThanOrEqualTo returns true if the given *metav1.Time is set and earlier than or equal to the other time.Time. Useful to validate timestamp updates which cannot be extended.

func IsTimeSetAndLater

func IsTimeSetAndLater(ts *metav1.Time) bool

IsTimeSetAndLater returns true if the given *metav1.Time is set and later than the current time. Useful to validate timestamp updates which cannot be extended.

func IsTimeSetAndLaterThan

func IsTimeSetAndLaterThan(ts *metav1.Time, other time.Time) bool

IsTimeSetAndLaterThan returns true if the given *metav1.Time is set and later than the other time.Time. Useful to validate timestamp updates which cannot be extended.

func IsTimeSetAndLaterThanOrEqualTo

func IsTimeSetAndLaterThanOrEqualTo(ts *metav1.Time, other time.Time) bool

IsTimeSetAndLaterThanOrEqualTo returns true if the given *metav1.Time is set and later than or equal to the other time.Time. Useful to validate timestamp updates which cannot be extended.

func IsUnixZero

func IsUnixZero(ts *metav1.Time) bool

IsUnixZero provides a more robust check for whether a metav1.Time is truly a zero time, by also checking if it is equivalent to the epoch (i.e. Unix() returns 0).

func Now

func Now() *metav1.Time

Now returns a *metav1.Time pointer for the current time.

func TimeMax

func TimeMax(ts1, ts2 *metav1.Time) *metav1.Time

TimeMax returns the maximum of two *metav1.Time objects.

func UnwrapMetaV1Time

func UnwrapMetaV1Time(ts *metav1.Time) time.Time

UnwrapMetaV1Time unwraps a *metav1.Time pointer into time.Time. If nil, a zero time is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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