diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-04-10 11:10:48 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-04-16 21:25:29 -0700 |
| commit | b96490241e342fe1aecbd3c4f40de6998d2a3eaa (patch) | |
| tree | c32866ba10bba17af4930ca1c6799d7092417cd2 | |
| parent | 2b39a27d40682c09ac1c031f099ee602061597cd (diff) | |
| download | git-b96490241e342fe1aecbd3c4f40de6998d2a3eaa.tar.gz git-b96490241e342fe1aecbd3c4f40de6998d2a3eaa.zip | |
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>
| -rw-r--r-- | Documentation/CodingGuidelines | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index b8670751f5..b9a29e39f2 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -681,6 +681,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 a timestamp in whole + second resolution, "st_mtime" should work fine everywhere. + + For Perl programs: - Most of the C guidelines above apply. |
