clock

package
v0.0.0-...-8a41e16 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Clock knows how to get the current time, Provides a mechanism for mocking the time in tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParseDuration

func MustParseDuration(d string) time.Duration

func MustParseTime

func MustParseTime(RFC3339Time string) time.Time

Types

type Clock

type Clock interface {
	Now() time.Time
}

clock knows how to get the current time. It can be used to fake out timing for testing.

type RealClock

type RealClock struct{}

func (RealClock) Now

func (RealClock) Now() time.Time

type TestClock

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

func (TestClock) Now

func (c TestClock) Now() time.Time

func (*TestClock) Set

func (c *TestClock) Set(t time.Time)

func (*TestClock) SetTime

func (c *TestClock) SetTime(RFC3339Time string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳