[tz] Fwd: Bulletin C number 58

Chris Woodbury tzocd at yahoo.com
Sat Jul 27 22:15:27 UTC 2019

On Sat Jul 27 14:21:34 UTC 2019, Paul Eggert <eggert at cs.ucla.edu> wrote:

>Thanks, I installed that into the development version on GitHub.
>I see that the updated file has a space at the end of the '#@ 3802291200' line 
>that encodes the expiration (2020-06-28 00:00:00 UTC). I assume this was 
>inadvertent. It doesn't break tzcode (which ignores that line), but the format 
>of the line is not documented anywhere that I can see. I dropped Judah Levine a 
>line about this.

Back in the dark ages, when I first started writing C code, it was said that
the ultimate documentations was the code.  In the NTP daemon, there is
a subroutine leapsec_load() in which is the following:

while (get_line(func, farg, linebuf, sizeof(linebuf))) {
        cp = linebuf;
        if (*cp == '#') {
            if (*cp == '@') {
                cp = skipws(cp+1);
                pt->head.expire = strtouv64(cp, &ep, 10);

strtouv64() is an NTP native subroutine (found in libntp/vint64ops.c)
which reads numeric data in a specified base (in this case 10).  It skips
"whitespace" (so the call to skipws() is superfluous), and then converts 
the digits, one at a time, to numeric in that base.  It quits conversion 
when whatever it's pointing at isn't a digit in the selected base and 
returns the number and "ep", a pointer to where it stopped parsing. 
This allows for comments and/or additional data.  So, a space instead
of a line terminator or say, a comment such as "\t# 28 Jun 2020", after 
the expiration NTP timestamp is an acceptable field termination.

Anyone who cares to can reference the "standard" implementation of
the NTP code found at: <http://www.ntp.org/downloads.html>

 The Network Time Protocol (NTP) is used to synchronize the time of a 
computer client or server to another server...   

More information about the tz mailing list