Skip to content

Commit e256d21

Browse files
committed
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>
1 parent 2b39a27 commit e256d21

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Documentation/CodingGuidelines

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,12 @@ For C programs:
681681
char *dogs[] = ...;
682682
walk_all_dogs(dogs);
683683

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 timestamp in whole
687+
second resolution, "st_mtime" should work fine everywhere.
688+
689+
684690
For Perl programs:
685691

686692
- Most of the C guidelines above apply.

0 commit comments

Comments
 (0)