Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uint64timestamp

GitHub All Releases GitHub release (latest by date) GitHub tag (latest by date) Go Report Card

Timestamp fitted into uint64. There are two different versions: Base10 which is for humans and more binary packed Base2.

Base10 Base2
Accuracy microseconds (tens (10)) nanoseconds (hundreds (100))

Base10 - human parsable

See pkg/base10 for details.

Example: 2023051514142573247 is 2023-05-15 14:14:25.73247

now := time.Now()

bin, err := base10.TimeToUint64(now)
if err != nil {
    panic(err)
}

humanTime, err := base10.Uint64ToTime(bin, now.Location())
if err != nil {
    panic(err)
}

Base2 - binary

See pkg/base2 for details.

Example: 2278081318148840948 is 2023-05-15 14:14:25.732479

now := time.Now()

bin, err := base2.TimeToUint64(now)
if err != nil {
    panic(err)
}

binTime, err := base2.Uint64ToTime(bin, now.Location())
if err != nil {
    panic(err)
}

About

timestamp fitted into uint64

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages