monotime

package
v0.0.0-...-17244d7 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package monotime provides functions to access monotonic clock source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Now

func Now() time.Duration

Now returns the current time in nanoseconds from a monotonic clock.

The time returned is based on some arbitrary platform-specific point in the past. The time returned is guaranteed to increase monotonically without notable jumps, unlike time.Now() from the Go standard library, which may jump forward or backward significantly due to system time changes or leap seconds.

It's implemented using runtime.nanotime(), which uses CLOCK_MONOTONIC on Linux. Note that unlike CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC is affected by time changes. However, time changes never cause clock jumps; instead, clock frequency is adjusted slowly.

func Since

func Since(t time.Duration) time.Duration

Since returns the time elapsed since t, obtained previously using Now.

Types

This section is empty.

Jump to

Keyboard shortcuts

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