package
0.0.2
Repository: https://github.com/yubo/golib.git
Documentation: pkg.go.dev

# README

Clock

This package provides an interface for time-based operations. It allows mocking time for testing.

# Functions

NewFakeClock returns a new FakeClock.
NewFakePassiveClock returns a new FakePassiveClock.

# Structs

FakeClock implements Clock, but returns an arbitrary time.
FakePassiveClock implements PassiveClock, but returns an arbitrary time.
IntervalClock implements Clock, but each invocation of Now steps the clock forward the specified duration.
RealClock really calls time.Now().

# Interfaces

Clock allows for injecting fake or real clocks into code that needs to do arbitrary things based on time.
PassiveClock allows for injecting fake or real clocks into code that needs to read the current time but does not support scheduling activity in the future.
Ticker defines the Ticker interface.
Timer allows for injecting fake or real timers into code that needs to do arbitrary things based on time.