CodingGuidelines: st_mtimespec vs st_mtim vs st_mtime
Most unfortunately macOS does not support st_[amc]tim for timestamps down to nanosecond resolution as POSIX systems. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Apr 10, 2026 at 11:10 UTC
b96490241e342fe1aecbd3c4f40de6998d2a3eaa
1 file changed
+6
Documentation/CodingGuidelines
+6
@@ -681,6 +681,12 @@ For C programs:
681
char *dogs[] = ...;
682
walk_all_dogs(dogs);
683
684
+ - For file timestamps, do not use "st_mtim" (and other timestamp
685
+ members in "struct stat") unconditionally; not everybody is POSIX
686
+ (grep for USE_ST_TIMESPEC). If you only need a timestamp in whole
687
+ second resolution, "st_mtime" should work fine everywhere.
688
+
689
+
690
For Perl programs:
691
692
- Most of the C guidelines above apply.