clock

package
v0.0.0-...-388d6c9 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package clock provides a clock interface and a real clock implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock is an interface for getting the current time.

func New

func New() Clock

New returns a new clock that returns the current time.

func NewFakeClock

func NewFakeClock(t time.Time) Clock

NewFakeClock returns a new fake clock.

type FakeClock

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

FakeClock is a clock that returns a fake time.

func (*FakeClock) Now

func (c *FakeClock) Now() time.Time

Now returns the fake time.

type RealClock

type RealClock struct{}

RealClock is a clock that returns the current time.

func (*RealClock) Now

func (c *RealClock) Now() time.Time

Now returns the current time.

Jump to

Keyboard shortcuts

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