package module
Version: v0.0.0-...-ac39333 Latest Latest

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

Go to latest
Published: Aug 26, 2017 License: Apache-2.0 Imports: 2 Imported by: 0



Provides access to a fast monotonic clock source, to fill in the gap in the Go standard library, which lacks one: see Don't use time.Now() in code that needs to time things or otherwise assume that time passes at a constant rate. Instead use monotime.Now().

On linux, this uses the same vdso as clock_gettime(CLOCK_MONOTONIC,...) to retreive a monotonic timestamp.

You cannot just eplace calls to time.Now() with time.Unix(0, int64(monotime.Now())), because monotime.Now() doesn't produce an actual timestamp value. Instead it is relative to the os boot time (on linux; or some arbitrary fixed point in time in the past on others).

Courtesy of and

Copyright (C) 2016 Arista Networks, Inc. LICENSE: Apache2; see LICENSE file.



Package monotime provides a fast monotonic clock source.



This section is empty.


This section is empty.


func Now

func Now() uint64

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 at a constant rate, unlike time.Now() from the Go standard library, which may slow down, speed up, jump forward or backward, due to NTP activity or leap seconds.


type IdleTimer

type IdleTimer struct {
	// contains filtered or unexported fields

func (*IdleTimer) NanosecSince

func (t *IdleTimer) NanosecSince() uint64

func (*IdleTimer) Reset

func (t *IdleTimer) Reset()

Jump to

Keyboard shortcuts

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