|
From: | Gregory Heytings |
Subject: | Re: Represent NTP's origin time |
Date: | Thu, 15 Apr 2021 14:06:09 +0000 |
So, getting back to the question: Do we have some "standard" workaround? I don't actually need to represent times from the early 20th century, but I need to compute NTP timestamps. I can come up with my own workaround (e.g. hardcoding as a "magic constant" the number of seconds between NTP's origin time and some arbitrary other origin time of my choosing which 32bit systems can represent), but I was hoping we already have something like that somewhere.
Apparently there is no standard workaround in Emacs. So on a 32bit system, I would use the constant 2208988800 (25567 days times 86400 seconds), to represent the difference in seconds between 1900-01-01 and 1970-01-01 (epoch). This constant is given in the very first NTP RFC [1], and doing this should be safe: the current NTP format (32 bits for the integer part) will work until Feb 7, 2036, that is, before 32-bit counting after epoch will stop working on Jan 19, 2038.
[1] https://tools.ietf.org/html/rfc868
[Prev in Thread] | Current Thread | [Next in Thread] |