[ntp:questions] TimeStamp

Brian Utterback brian.utterback at sun.com
Wed Oct 31 14:11:29 UTC 2007


Aggie wrote:
> Dear all,
> I'm very confused on how ntp do the timestamp. I'm running ntpd on
> vxworks. It seems to me that the receive timestamp and the Transmit
> timestamp are using two different clocks, because when I use ethereal/
> wireshark to look up the information of the ntp packet,
> the Recevie Time Stamp is: Jan 1, 1970 00:21:26.0827 UTC
> the Transmit Time Stamp is : Oct 29, 2007 15:20:30.1500 UTC
> 
> However, the actual time period between these two time stamps is only
> a couple second apart. It makes me think that they are using to
> different clock to stamp the packet. Am I Right???
> 
> Kevin
> 

I don't know much about VxWorks, but if it supports the SO_TIMESTAMP
socket option, then ntpd will use it to get the receive timestamp.
However, the transmit timestamp will be retrieved via the gettimeofday
system call. I don't think that it would be too hard to believe that
VxWorks is using an uptime counter rather than the timeofday clock
to provide the timestamp. If you set the debug level of ntpd to 4,
it will print out the timestamp associated with a packet in a message
that begins "fetch_timestamp". This value is the raw seconds and
microseconds before the correction to 1970. If this value is near
zero or rather near the uptime in seconds, then I think that would
amount to a smoking gun.

Brian Utterback




More information about the questions mailing list