npt

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NPT

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

NPT is a time-holding object that does not have timezone pointer. It's more memory-effective than default Go time.Time and can be used in apps that store time in memory only and do not serialize it.

For example: logger package that works with huge amount of events or action buffer that doesn't need extra precision.

Important: NPT does not provide exact precision up to nano. Max precision is up to a second.

func Now

func Now() NPT

Now creates NPT from current moment in time

func (*NPT) Add

func (t *NPT) Add(d time.Duration)

ToNow sets internal NPT values to current moment

func (*NPT) FromTime

func (t *NPT) FromTime(tm time.Time)

FromTime sets internal NPT values to specified time value

func (*NPT) Time

func (t *NPT) Time() time.Time

Time cunverts NPT into Time object

func (*NPT) ToNow

func (t *NPT) ToNow()

ToNow sets internal NPT values to current moment

Jump to

Keyboard shortcuts

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