Messages in this thread | | | Date | Tue, 8 Nov 2005 13:56:23 +0100 (CET) | From | Roman Zippel <> | Subject | Re: CLOCK_REALTIME_RES and nanosecond resolution |
| |
Hi,
On Tue, 8 Nov 2005, Benjamin Herrenschmidt wrote:
> > This is the resolution which you can expect for timers (nanosleep and > > interval timers) as the timers depend on the jiffy tick. > > > > The resolution of the readout functions is not affected by this. > > Ok, thanks, POSIX spec wasn't very clear about that
Actually the spec is a bit more clear than that:
"This volume of IEEE Std 1003.1-2001 defines functions that allow an application to determine the implementation-supported resolution for the clocks and requires an implementation to document the resolution supported for timers and nanosleep() if they differ from the supported clock resolution."
Historically the clock and timer resolution was equal and e.g. clock_gettime() returned a msec value. To get usec resolution one had to enable the MICRO_TIME, but this didn't change the clock_getres() value, as at that time higher clock_gettime() resolution was interpolated from a second time source and the actual clock tick remained unchanged. Subsequent UNIX generations have preserved this behaviour.
Thomas' expectation is not generally true, non-UNIX implementations return different values here and his expectation is not required by POSIX, it's more a traditional UNIX behaviour.
bye, Roman - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |