proxy.golang.org : github.com/xtgo/epochdate
Package epochdate provides date handling in a compact format. Represents dates from Jan 1 1970 - Jun 6 2149 as days since the Unix epoch. This format requires 2 bytes (it's a uint16), in contrast to the 16 or 20 byte representations (on 32 or 64-bit systems, respectively) used by the standard time package. Timezone is accounted for when applicable; when converting from standard time format into a Date, the date relative to the time value's zone is retained. Times at any point during a given day (relative to timezone) are normalized to the same date. Conversely, conversions back to standard time format may be done using the Local, UTC, and In methods (semantically corresponding to the same-named Time methods), but with the result normalized to midnight (the beginning of the day) relative to that timezone. All functions and methods with the same names as those found in the stdlib time package have identical semantics in epochdate, with the exception that epochdate truncates time-of-day information. epochdate does not handle leap seconds, and is thus generally follows the behavior of the standard library time package, which it uses for translating to and from Date and YearMonth values, parsing, and formatting. epochdate does not handle leap seconds, which may result in a low risk of date inconsistencies when calling New/ClampFromUnix directly, if that timestamp falls on the zeroth second of a day more than six months in the future. In particular, if that second was selected as a leap second, the initial call may result in a value one lower than if that same call were made after the leap second had been amended into the standard library time package. Using New/ClampFromTime and New/ClampFromDate should prevent such a discrepancy.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/xtgo/epochdate
License: BSD-3-Clause
Latest release: over 5 years ago
First release: almost 11 years ago
Namespace: github.com/xtgo
Stars: 2 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 1 day ago