fastime

package
v0.0.0-...-bb1a4e7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nanosecond  Duration = 1
	Microsecond          = 1000 * Nanosecond
	Millisecond          = 1000 * Microsecond
	Second               = 1000 * Millisecond
	Minute               = 60 * Second
	Hour                 = 60 * Minute
)

Common durations. There is no definition for units of Day or larger to avoid confusion across daylight savings time zone transitions.

To count the number of units in a Duration, divide:

second := time.Second
fmt.Print(int64(second/time.Millisecond)) // prints 1000

To convert an integer number of units to a Duration, multiply:

seconds := 10
fmt.Print(time.Duration(seconds)*time.Second) // prints 10s

Variables

This section is empty.

Functions

func Unix

func Unix() int64

func UnixNano

func UnixNano() int64

Types

type Duration

type Duration int64

A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.

func (Duration) Nanoseconds

func (d Duration) Nanoseconds() int64

Nanoseconds returns the duration as an integer nanosecond count.

func (Duration) Seconds

func (d Duration) Seconds() float64

type FastTime

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

fast time struct stored on stack

func FromTime

func FromTime(nanos int, unix int64) FastTime

func NewFastTime

func NewFastTime() FastTime

func Now

func Now() FastTime

func (FastTime) Add

func (t FastTime) Add(duration Duration) FastTime

func (FastTime) Nanos

func (t FastTime) Nanos() uint32

func (FastTime) Raw

func (t FastTime) Raw() int64

func (FastTime) SafeBytes

func (t FastTime) SafeBytes() []byte

func (FastTime) Unix

func (t FastTime) Unix() int64

func (FastTime) UnsafeBytes

func (t FastTime) UnsafeBytes() []byte

Jump to

Keyboard shortcuts

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