clockutil

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Advance

func Advance(candidate, previous time.Time) time.Time

Advance returns candidate normalized to UTC when it is later than previous. When wall-clock time has not advanced, it advances previous by one nanosecond to preserve persisted timestamp ordering.

func Next

func Next(value Clock, previous time.Time) time.Time

Next reads a Clock and returns a timestamp strictly later than previous.

func NowUTC

func NowUTC(value Clock) time.Time

NowUTC reads a Clock and normalizes its result to UTC.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock supplies the current time to services that create persisted timestamps.

type System

type System struct{}

System reads the current time from the system wall clock.

func (System) Now

func (System) Now() time.Time

Now returns the current system time normalized to UTC.

Jump to

Keyboard shortcuts

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