diff options
author | Jim Meyering <jim@meyering.net> | 2001-08-12 08:47:19 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2001-08-12 08:47:19 +0000 |
commit | 7292e5031b0a794a9f99f71c651c3718fd20323d (patch) | |
tree | cf59eeeea17a8839b59df58cbd1fb6673d265a6f /src | |
parent | 98950444e69ca2eeeb07ab38e1b6733eca81fdd2 (diff) | |
download | coreutils-7292e5031b0a794a9f99f71c651c3718fd20323d.tar.xz |
Work around non-compliant gettimeofday on Mac OS X 10.0.4,
(aka Darwin 1.3.7) that caused the date of the first file listed
in long output to be the current time rather than the file's mtime.
The real work is in m4/gettimeofday.m4 and the wrapper function,
lib/gettimeofday.c.
Include gtod.h.
(main): `Call' GETTIMEOFDAY_INIT.
(print_long_format): Add a comment about gettimeofday.
Diffstat (limited to 'src')
-rw-r--r-- | src/ls.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -119,6 +119,7 @@ int wcwidth (); #include "quotearg.h" #include "strverscmp.h" #include "xstrtol.h" +#include "gtod.h" /* Use access control lists only under all the following conditions. Some systems (OSF4, Irix5, Irix6) have the acl function, but not @@ -895,6 +896,8 @@ main (int argc, char **argv) atexit (close_stdout); + GETTIMEOFDAY_INIT (); + #define N_ENTRIES(Array) (sizeof Array / sizeof *(Array)) assert (N_ENTRIES (color_indicator) + 1 == N_ENTRIES (indicator_name)); @@ -2662,7 +2665,13 @@ print_long_format (const struct fileinfo *f) the last time we checked the clock. */ if (current_time < when || (current_time == when && current_time_ns < when_ns)) - get_current_time (); + { + /* Note that get_current_time calls gettimeofday which, on some non- + compliant systems, clobbers the buffer used for localtime's result. + But it's ok here, because we use a gettimeofday wrapper that + saves and restores the buffer around the gettimeofday call. */ + get_current_time (); + } /* Consider a time to be recent if it is within the past six months. A Gregorian year has 365.2425 * 24 * 60 * 60 == |