tcpdump mailing list archives

Re: nanosecond timestamp


From: Darren Reed <darrenr () reed wattle id au>
Date: Fri, 10 Dec 2004 10:02:45 +1100 (EST)

In some email I received from rick jones, sie wrote:
BTW, where are you getting the nanosecond-resolution time stamps in
Solaris?

gethrtime

there is such a thing in some of the other OSes as well - netperf will 
use it for -DHISTOGRAM because it typically is lower overhead.

however, my recollection of the manpages is that it is only good for 
relative time, not clock time.  perhaps that is "ok" here but it will 
be a semantic (right term?) difference from gettimeofday().

Perhaps, the man page says:

     The gethrtime() function returns the current high-resolution
     real time. Time is expressed as nanoseconds since some arbi-
     trary time in the past; it is not correlated in any  way  to
     the  time  of  day,  and thus is not subject to resetting or
     drifting by way of adjtime(2) or settimeofday(3C).  The  hi-
     res  timer  is  ideally  suited  to  performance measurement
     tasks, where cheap, accurate interval timing is required.

So something like "getimeofday(&foo, NULL); foohr = gethrtime()"
would approximately equate foohr with foo, such that you could
use the change in gethrtime() values returned to calculate the
current time with more accuracy than just gettimeofday() ?

Darren
-
This is the tcpdump-workers list.
Visit https://lists.sandelman.ca/ to unsubscribe.


Current thread: