monotonic

package
v0.0.0-...-7c5bcf4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package monotonic provides a monotonic clock. The clock is safe for concurrent use and can be used to generate increasing timestamps as int64s with a given precision.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

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

Clock is a monotonic clock that generates increasing timestamps.

func NewClock

func NewClock(precision time.Duration) (*Clock, error)

NewClock creates a new Clock with the given precision.

func (*Clock) Now

func (c *Clock) Now() int64

Now returns the current timestamp as an int64 of the Clock's precision. Now will always return a monotonically increasing value.

Jump to

Keyboard shortcuts

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