crtime

package
v0.0.0-...-fe658a2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: Apache-2.0 Imports: 2 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicMono

type AtomicMono = crsync.TypedAtomicInt64[Mono]

AtomicMono provides atomic access to a Mono value.

type Mono

type Mono time.Duration

Mono represents a moment in time in terms of a monotonic clock. Its value is the duration since the start of the process.

Note that if the system doesn't support a monotonic clock, the wall clock is used.

func MonoFromTime

func MonoFromTime(t time.Time) Mono

MonoFromTime converts a time.Time to a Mono value. If the time has a monotonic component, it is used.

func NowMono

func NowMono() Mono

NowMono returns a moment in time in terms of a monotonic clock. It is faster than time.Now which also consults the wall clock.

func (Mono) Add

func (m Mono) Add(d time.Duration) Mono

Add returns the moment m+d.

func (Mono) Elapsed

func (m Mono) Elapsed() time.Duration

Elapsed returns the duration that elapsed since m.

func (Mono) Sub

func (m Mono) Sub(other Mono) time.Duration

Sub returns the duration that elapsed between two moments.

func (Mono) ToUTC

func (m Mono) ToUTC() time.Time

ToUTC returns the UTC time corresponding to the monotonic time.

The time is derived from the current wall clock, adjusted by the difference in the monotonic clock values. Note that if the wall clock has been changed since the Mono value was obtained, the result does not reflect the wall clock at that point in time.

Jump to

Keyboard shortcuts

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