lfpinit() signed or unsigned?

Hal Murray hmurray at megapathdsl.net
Fri Mar 10 20:40:11 UTC 2017


gem at rellim.com said:
>> Be careful with making negative values.  The case I'm worried about
>> is dropping the carry out of the low half.
> The code has a normalize_tspec() ir prolly needs a normalize_lp(). 

There is nothing to normalize in a l_fp  All bit patterns are valid.


> Because a RasPi has no RTC.  When it starts up it is always 1970 again.
> When 2036 comes, how will the RasPi know it is 2036 and not 1970? 

I think the build date of the code will be a good start.


>> ctl_putfs is only used to printout leap second dates.
>Looks to me like it is creating an NTP mode 6 message in wire format.

The text on the wire is a date string:
        snprintf(cp, sizeof(buffer) - (cp - buffer),
                 "%04d%02d%02d%02d%02d", tm->tm_year + 1900,
                 tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min);

The values getting printed are coming from the leap-second file.
#       The NTP timestamps are in units of seconds since the NTP epoch,
#       which is 1 January 1900, 00:00:00.
They are strings, so we don't have to worry about overflow.  We can convert 
to POSIX time_t when they are read in with a simple sub.

[My offer to try to fix that area]
> I have some ideas, but if it makes sense to you, go ahead.

OK.  I'll go look into it.





-- 
These are my opinions.  I hate spam.





More information about the devel mailing list