On Wed, Aug 19, 2026 at 07:01:59PM +0200, Steffen Nurpmeso wrote:
> Musl impl is

>   #include "syscall.h"
> 
>   time_t time(time_t *t)
>   {
>           struct timespec ts;
>           __clock_gettime(CLOCK_REALTIME, &ts);
>           if (t) *t = ts.tv_sec;
>           return ts.tv_sec;
>   }


I believe glibc uses CLOCK_REALTIME_COARSE in that syscall (but
CLOCK_REALTIME for the gettimeofday(2) function). 

If I understand correctly, CLOCK_REALTIME asks the clock hardware
whereas CLOCK_REALTIME_COARSE fetches a stored value that is updated
once per jiffy.

On modern systems HZ=1000, but my testing showed a delay of up to 1.53ms
on x86_64 and 1.08ms on arm64.

Ian Collier.

Reply via email to