On Thu, Aug 20, 2026 at 10:54 +0800, Kevin J. McCarthy wrote:

Recent Linux kernels have an issue where time() has a lower
granularity than the stat st_mtime of a file.  This can result in
time() being earlier than the mtime of a file just modified.
See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1144613

Oswald is right that it should work to truncate times to the second for comparison. (I guess time() + 1 is a shortcut to the same outcome.) Might be some trouble to do that portably. There's the standard C library function difftime()...

Seems better to do that than to hit the filesystem through stat().

Reply via email to