[ntp:questions] sntp code: what pack_ntp is doung,

David Woolley david at ex.djwhome.demon.co.uk.invalid
Thu Apr 10 19:40:12 UTC 2008


Pg wrote:

>     for (i = 0; i < 8; ++i) {
>         if ((k = (int)(d *= 256.0)) >= 256) k = 255;
>         packet[NTP_TRANSMIT+i] = k;
>         d -= k;
>     }

More precisely, it is doing a float to scaled binary conversion in 
network byte order, with a hack to cope with rounding errors.  I'm a bit 
  uneasy about the hack.




More information about the questions mailing list