clock

package
v0.0.0-...-55e4108 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: Apache-2.0 Imports: 3 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

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

Clock wraps a time.Time to represent a simulated time.

func NewClock

func NewClock(t time.Time) Clock

NewClock creates a new Clock with the given time.Time.

func NewClockWithMetaV1

func NewClockWithMetaV1(t metav1.Time) Clock

NewClockWithMetaV1 creates a new Clock with the given metav1.Time.

func (Clock) Add

func (c Clock) Add(dur time.Duration) Clock

Add calculates the clock ahead of this Clock by the given duration.

func (Clock) Before

func (c Clock) Before(rhs Clock) bool

Before returns whether this Clock is before rhs.

func (Clock) MarshalJSON

func (c Clock) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (Clock) String

func (c Clock) String() string

String implements Stringer interface.

func (Clock) Sub

func (c Clock) Sub(rhs Clock) time.Duration

Sub calculates the duration from rhs to this Clock.

func (Clock) ToMetaV1

func (c Clock) ToMetaV1() metav1.Time

ToMetaV1 converts this Clock to metav1.Time.

func (Clock) ToRFC3339

func (c Clock) ToRFC3339() string

ToRFC3339 formats this Clock to a string in RFC3339 format.

Jump to

Keyboard shortcuts

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