Yo Hal! On Fri, 10 Mar 2017 00:59:49 -0800 Hal Murray <hmur...@megapathdsl.net> wrote:
> > I'm now leaning that way too. And two ways to make an l_fp, one > > starting with int's and the other uint's. > > 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(). > > The npd code is gonna be OK, the problem is that the NTP wire > > protocol for timestamps is in 32 bits! > > Why is that a problem? 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? > To convert between NTP and Unix... Until 2036, you just add/sub > JAN_1970. After 2036 add/sub JAN_1970 and 1<<32 if T < build date. > (Or something close to that.) I love the lcak of confidence you have there. Could should be obvious. > >> Does the current code have the right variable? Have you found it? > >> Is there more than one place that does NTP to Unix conversion? > > Sort of. The conversion constant is JAN_1970. That is defined in > > include/ ntp_calendar.h. > > That constant doesn't have anything to do with calendars. I'm not > sure where it should go. Good enough place for now. > In the long run, it's more complicated. See above. Oh, yeah. > > There is a macro to do the conversion from timestamp to NTP Epoch: > > tspec_stamp_to_lfp(), but it is not always used. > > > There look to be just two places the conversion from NTP Epoch is > > done: ntpcal_ntp_to_time() and ctl_putfs(). And the later not even > > using l_fp, it uniquely uses tstamp_t which is seconds based on NTP > > Epoch. > > 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. To change that you would need to change the mode 6 protocol. > I don't see any > reason to involve NTP date formats or epochs. From a quick glance, > the NTP in the comment where it is defined looks bogus. I'll clean > that up if you want to unload a nice small chunk, but it looks like > you have already done something in that area. I have some ideas, but if it makes sense to you, go ahead. > I haven't sorted out ntpcal_ntp_to_time yet. Easy, it is just converting a 32 bit NTP Epoch time stamp into a POSIX Epoch time stamp. It is not worth a lot of time it is only used in libntp/prettydate.c common_prettydate(). ntpcal_ntp_to_time() could become a static in libntp/prettydate.c RGDS GARY --------------------------------------------------------------------------- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 g...@rellim.com Tel:+1 541 382 8588 Veritas liberabit vos. -- Quid est veritas? "If you can’t measure it, you can’t improve it." - Lord Kelvin
pgpZ03KDHaWzf.pgp
Description: OpenPGP digital signature
_______________________________________________ devel mailing list devel@ntpsec.org http://lists.ntpsec.org/mailman/listinfo/devel