package
0.0.0-20241221112132-06f9af878c14
Repository: https://github.com/brpaz/lib-go.git
Documentation: pkg.go.dev

# README

timeutil

import "github.com/brpaz/lib-go/timeutil"

Package timeutil contains utility functions for working with Time.

Index

type Clock

Clock interface for time operations.

type Clock interface {
    Now() time.Time
}

type MockClock

MockClock is a mock implementation of Clock.

type MockClock struct {
    FixedTime time.Time
}

func NewMockClock

func NewMockClock(now time.Time) MockClock

NewMockClock creates a new instance of MockClock. MockClock uses a fixed time to get the current time.

func (MockClock) Now

func (m MockClock) Now() time.Time

type RealClock

RealClock is the real implementation using time.Now().

type RealClock struct{}

func NewRealClock

func NewRealClock() RealClock

NewRealClock creates a new instance of RealClock. RealClock uses time.Now() to get the current time.

func (RealClock) Now

func (r RealClock) Now() time.Time

Generated by gomarkdoc