monotime

package
v2.0.28+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: GPL-3.0, Apache-2.0 Imports: 2 Imported by: 0

README

Originally forked from https://github.com/Psiphon-Labs/goarista/commit/690920d232c6046c512b4527417e1d9a2b930c92.

With the addition of https://github.com/Psiphon-Labs/goarista/commit/d002785f4c6725d9f62f0e3e7b1e2a20455ed027:

Add helpers for Psiphon integration
* monotime.Time type makes it clear when
  a non-"wall" clock time is being used.
* functions including Add, Sub, After, and
  Before enable drop-in replacement of
  time.Now() with monotime.Now() for
  duration calculations.

Documentation

Overview

Package monotime provides a fast monotonic clock source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Since

func Since(t Time) time.Duration

Since is analogous to https://golang.org/pkg/time/#Since

Types

type Time

type Time int64

Time is a point in time represented in nanoseconds.

func Now

func Now() Time

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.

func (Time) Add

func (t Time) Add(d time.Duration) Time

Add is analogous to https://golang.org/pkg/time/#Time.Add

func (Time) After

func (t Time) After(u Time) bool

After is analogous to https://golang.org/pkg/time/#Time.After

func (Time) Before

func (t Time) Before(u Time) bool

Before is analogous to https://golang.org/pkg/time/#Time.Before

func (Time) Equal

func (t Time) Equal(u Time) bool

Equal is analogous to https://golang.org/pkg/time/#Time.Equal

func (Time) Sub

func (t Time) Sub(s Time) time.Duration

Sub is analogous to https://golang.org/pkg/time/#Time.Sub

Jump to

Keyboard shortcuts

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