timestamp

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromVarint

func FromVarint(b B) (t *T, rem B, err error)

Types

type B

type B = []byte

func ToVarint

func ToVarint(dst B, t *T) B

type E

type E = error

type S

type S = string

type T

type T int64

T is a convenience type for UNIX 64 bit timestamps of 1 second precision.

func FromBytes

func FromBytes(b []byte) *T

FromBytes converts from a string of raw bytes.

func FromTime

func FromTime(t time.Time) *T

FromTime returns a T from a time.Time

func FromUnix

func FromUnix(t int64) *T

FromUnix converts from a standard int64 unix timestamp.

func New

func New() (t *T)

func Now

func Now() *T

Now returns the current UNIX timestamp of the current second.

func (*T) Bytes

func (t *T) Bytes() (b B)

func (*T) FromInt

func (t *T) FromInt(i int)

func (*T) FromVarint

func (t *T) FromVarint(dst B) (b B)

func (*T) I64

func (t *T) I64() int64

I64 returns the current UNIX timestamp of the current second as int64.

func (*T) Int

func (t *T) Int() int

Int returns the timestamp as an int.

func (*T) MarshalJSON

func (t *T) MarshalJSON(dst B) (b B, err error)

func (*T) String

func (t *T) String() (s S)

func (*T) Time

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

Time converts a timestamp.Time value into a canonical UNIX 64 bit 1 second precision timestamp.

func (*T) U64

func (t *T) U64() uint64

U64 returns the current UNIX timestamp of the current second as uint64.

func (*T) UnmarshalJSON

func (t *T) UnmarshalJSON(b B) (r B, err error)

Jump to

Keyboard shortcuts

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