From: Elijah Newren Date: Thu, 16 Apr 2026 23:46:13 GMT Subject: Re: [PATCH] CodingGuidelines: st_mtimespec vs st_mtim vs st_mtime Message-ID: In-Reply-To: On Fri, Apr 10, 2026 at 11:10 AM Junio C Hamano wrote: > > Most unfortunately macOS does not support st_[amc]tim for timestamps > down to nanosecond resolution as POSIX systems. > > Signed-off-by: Junio C Hamano > --- > Documentation/CodingGuidelines | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git c/Documentation/CodingGuidelines w/Documentation/CodingGuidelines > index 4992e52093..4e54139fd7 100644 > --- c/Documentation/CodingGuidelines > +++ w/Documentation/CodingGuidelines > @@ -693,6 +693,12 @@ For C programs: > char *dogs[] = ...; > walk_all_dogs(dogs); > > + - For file timestamps, do not use "st_mtim" (and other timestamp > + members in "struct stat") unconditionally; not everybody is POSIX > + (grep for USE_ST_TIMESPEC). If you only need timestamp in whole > + second resolution, "st_mtime" should work fine everywhere. > + > + > For Perl programs: > > - Most of the C guidelines above apply. Looks good to me. As a minor nit, "need timestamp" -> "need a timestamp".