Re: [PATCH] Change attachment stamping to use stat st_mtime by default.

Vincent Lefevre <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <[email protected]>
On 2026-08-20 12:29:57 +0200, Oswald Buddenhagen via Mutt-dev wrote:
> On Thu, Aug 20, 2026 at 10:54:23AM +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.
> > 
> the granularity is one second. st_mtime is a subset of st_mtim which has a
> higher granularity, but that's been the case for decades, at least on fs
> that actually support it.

st_mtim has been more precise for years, but it was not accurate.
Its accuracy has been improved (to match CLOCK_REALTIME?) in

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4e40eff0b5737c

(starting with the 6.13 kernel), which is the cause of this issue.

> > This can result in time() being earlier than the mtime of a file
> > just modified.
> > 
> it can't, as long as only the full seconds are compared.

It can (even if you take the nanoseconds of st_mtim into account
as they are non-negative[*]), as shown by the tests.

[*] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1144613#32

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.