From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,caca7df87e7b7c35 X-Google-Attributes: gid1164f8,public From: mogul@actitis.pa.dec.com (Jeffrey Mogul) Subject: Re: gethrtime Date: 1997/08/19 Message-ID: <5tarq1$ghj@usenet.pa.dec.com>#1/1 X-Deja-AN: 267909226 References: Organization: DEC Western Research Newsgroups: comp.sys.dec In article , Dirk Grunwald writes: |> |> On SunOS systems, the 'gethrtime' function returns a high-resolution |> (nano-second scaling) timer. It returns a 64-bit value. |> |> On the alpha, you can use the RPCC instruction to get non-second |> resolution, but it's only 32-bits. Does anyone have a package for a |> 64-bit high-resolution time? Dirk already knows the answer, but just in case anyone else wants to know: look in the FAQ ftp://ftp.digital.com/pub/Digital/dec-faq/Digital-UNIX where it says: ============================================== P9. How can I get microsecond resolution from gettimeofday(2)? Question: how does one get microsecond resolution from the gettimeofday(2) system call? Answer: Normally, Digital UNIX updates its internal idea of the current time once per clock tick (1024 Hz, or about once per millisecond). In Digital UNIX V4.0 and later, it is possible to rebuild the kernel to support approximately microsecond resolution from the gettimeofday(2) system call, and from the various library routines that use this system call. To enable this option, add the following line to the kernel configuration file and rebuild the kernel: options MICRO_TIME The system clock (CLOCK_REALTIME) resolution as returned by clock_getres(3) will not change. Timer resolution remains the same. However, the granularity of the time returned by gettimeofday(2) and clock_gettime(3) will now be in microseconds. The time values returned are SMP safe and monotonically increasing. The high-resolution clock can be used for timestamping and for measuring durations on the order of microseconds, such as time spent in some critical code path. ============================================== -Jeff