On Wed, Aug 19, 2026 at 01:43:57PM +0200, Vincent Lefevre wrote:
> This is fine. However, I can reproduce the issue many times
> every second with
[redacted]
That's bizarre. So it seems the output of time(2) is delayed by
at least one jiffy with respect to the real time. Vide:
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
int main(void) {
struct timeval tv;
time_t t;
while (1) {
gettimeofday(&tv, NULL);
t = time(NULL);
if (t < tv.tv_sec)
printf("%ld < %ld.%06d\n", (long)t, (long)tv.tv_sec, (int)tv.tv_usec);
}
}
This produces output on every system I've tested so far, from Centos7
(3.10.0) upwards. But the generic 6.8.0 kernel on Ubuntu 24.04 (and
all earlier systems) does not produce output for the test that touches a
file. Whereas Ubuntu 24.04 systems running an OEM kernel (6.17.0) and
all Fedora systems do produce output from both tests.
This seems to mean that the Linux kernel has changed something about
how the time is obtained when touching a file; but ultimately it is
the time(2) call that is to blame.
Ian Collier.