proxy.golang.org : github.com/chmike/timez-go
Package timez provides compact binary encoding of UTC time and time offset. A timez value encodes the UTC time with microsecond precision and the local time offset in a 64 bit unsigned integer. Both values can be retrieved independently. This makes timez a convenient stamp value in binary messages crossing local time offset zones boundaries. The most interseting property of timez values is that comparing the integer values is the same as comparing by the timez values by UTC time and, when equal, by time offset. Timez values are then convenient and efficient to use as key in a sorted table, or as indexed value stored in a database. A Timez encodes the number of micro seconds elapsed since 1970-01-01T00:00:00.000000Z in the 53 most significant bits of a 64 bit unsigned integer. The time offset is encoded in the 11 less significant bits as a number of minutes relative to 1024. Thus the offset value 1024 is the time offset 00:00, the value 984 is the time offset -01:00, and the value 1084 it the time offset +01:00. The epoch is picked so that the unix time period is covered and beyond. The smallest representable time value is Jan 1 1970 00:00:00 minus 2^32-1 seconds as for the unix time. Since we have 33 bits to encode the number of seconds since that time, the timez epoch is 2^33 - 2^31. The biggest time value that can be represented with a timez value is in the year 2174.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/chmike/timez-go
License: MIT
Latest release: 4 months ago
Namespace: github.com/chmike
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 4 months ago