On Thu, Aug 20, 2026 at 01:53:50AM +0200, Vincent Lefevre wrote:
On 2026-08-19 21:05:42 +0100, Ian Collier via Mutt-dev wrote:
On Wed, Aug 19, 2026 at 08:36:49PM +0200, Vincent Lefevre wrote:
> However, is it guaranteed to be less or equal to the time given
> by CLOCK_REALTIME? This is not documented.

I don't know if this counts as documentation:
https://www.kernel.org/doc/html/latest/core-api/timekeeping.html#coarse-and-fast-ns-access

I meant by a standard, as Mutt needs to work on non-Linux systems
as well.

> So I would say that the fix for Mutt would be
>
>  void mutt_stamp_attachment(BODY *a)
>  {
> -  a->stamp = time(NULL);
> +  a->stamp = time(NULL) + 1;
>  }
>
> as suggested by Kevin.

Agreed.

There could actually be a better solution: instead of calling time(),
why doesn't Mutt get the mtime of the file just after the editor
has terminated or just after Mutt has created the file (in case of
$edit_headers set)? IMHO, this would make more sense as the goal is
to compare the value with a future value of the mtime of this file.

Thanks to everyone for the analysis and discussion. At least there is an understandable reason for the discrepancy.

Vincent, I'm fine with converting the stamp to use stat() instead. We'll have to have error handling code though, and in that case, perhaps a fallback of 'time(NULL) + 1'.

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to