mtime

package
v0.0.0-...-39e3913 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package mtime provides time operations using a monotonic time source, which is useful when you want to work with elapsed rather than wall time. Based on github.com/aristanetworks/monotime. mtime uses Instants. INSTANTS ARE NOT REAL TIMES, they are only useful for measuring elapsed time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stopwatch

func Stopwatch() (elapsed func() time.Duration)

Stopwatch starts a stopwatch and returns a function that itself returns the amount of time elapsed since the start of the stopwatch.

Types

type Instant

type Instant uint64

An Instant represents an instant in monotonically increasing time. INSTANTS ARE NOT REAL TIMES, they are only useful for measuring elapsed time.

func Now

func Now() Instant

Now() returns an instant in monotonic time

func (Instant) Add

func (i Instant) Add(d time.Duration) Instant

Add adds a duration to an Instant

func (Instant) Sub

func (i Instant) Sub(o Instant) time.Duration

Sub subtracts an Instant from an Instant

Jump to

Keyboard shortcuts

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