4 ms·
hwclock will only give you 1second resolution, because the RTC chip can't do better. But querying the RTC directly is dog slow by todays standards, it's accesse
by cnvogel 13y ago
hwclock will only give you 1second resolution, because the RTC chip can't do better. But querying the RTC directly is dog slow by todays standards, it's accessed via 8-bit port IO where one access eats up thousands of cpu cycles on a modern chip.
The really old way of timekeeping was to basically advance the system time by a constant amount, in an interrupt routine which might have been triggered by the ancient timer chip, and interpolation done between those ticks using the cpu TSCs.
And actually hwclock accesses /dev/rtc* which is just an arbitrary character devices (which the kernel indeed can use to initialize its notion of time on boot up), it's never accessed with the standard syscalls gettimeofday() or clock_gettime().
So while I really like MS bashing from time to time, in this case it's probably not too negligent of them, there might even be a standard way of informing the OS kernel about a change in TSC speed?