whence

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package whence contains some tidbits about time measurements and references

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point struct {
	Whence time.Time     `json:"whence"`    //datetime  when this point exists
	Delta  time.Duration `json:"delta"`     //delta from some reference to this time.
	Type   Reference     `json:"reference"` //internal reference for type
}

Point is a point in time, with optional information from a refernce

type Reference

type Reference string

Reference is a type of clock reference

const (
	//LOCALTIME is a reference from monotonicly increasing system clock
	LOCALTIME Reference = "localtime"

	//NTPClient is a sample reference w.r.t a NTP server
	NTPClient = "ntp"
)

func (Reference) MarshalJSON

func (r Reference) MarshalJSON() ([]byte, error)

MarshalJSON conforms to json.Marshaler interface

func (*Reference) String

func (r *Reference) String() string

String conforms to Stringer interface

func (*Reference) UnmarshalJSON

func (r *Reference) UnmarshalJSON(b []byte) error

UnmarshalJSON conforms to json.Marshaler interface

type Sampler

type Sampler interface {
	Measure() map[string]*Point //Measure performs the sample
}

Sampler can return some samples from some time services

func NewSampler

func NewSampler(dial string) Sampler

NewSampler returns a sampler that tries to use NTP

Jump to

Keyboard shortcuts

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