atomic_clock

package module
v1.0.2-0...-bc31757 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: CC0-1.0 Imports: 2 Imported by: 4

README

What

atomic_clock is convenient API around atomic int64 of monotonic clock. Use for time accounting. Do not use where actual time value matters.

Usage

Documentation

Key takeaways:

  • go get github.com/temoto/atomic_clock
  • Zero value of atomic_clock.Clock{} is usable.
  • Content is single int64 offset in nanoseconds from undefined epoch. Clock source is time.Since(epoch) which is monotonic since Go 1.9.

Flair

Build status Coverage Go Report Card

Documentation

Overview

Package atomic_clock is convenient API around atomic int64 monotonic clock. Use for time accounting. Do not use where actual time value matters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Since

func Since(begin *Clock) time.Duration

func Source

func Source() int64

Types

type Clock

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

func New

func New() *Clock

func Now

func Now() *Clock

func (*Clock) IsZero

func (c *Clock) IsZero() bool

func (*Clock) Set

func (c *Clock) Set(new int64)

func (*Clock) SetIfZero

func (c *Clock) SetIfZero(new int64)

func (*Clock) SetNow

func (c *Clock) SetNow()

func (*Clock) SetNowIfZero

func (c *Clock) SetNowIfZero()

func (*Clock) Sub

func (c *Clock) Sub(begin *Clock) time.Duration

Jump to

Keyboard shortcuts

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