diff options
author | Jim Meyering <meyering@redhat.com> | 2008-06-27 10:54:23 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-06-27 10:54:23 +0200 |
commit | a67685628504d92b80eabe7cdc02c500f12b4873 (patch) | |
tree | 55f09b93cd3d7454edf9b235815f0922c10a4d59 /src/stat.c | |
parent | e2dbcee444e90e4289bd4bdc36783a5ef00af396 (diff) | |
download | coreutils-a67685628504d92b80eabe7cdc02c500f12b4873.tar.xz |
factor out time_t-to-string conversion idiom
* src/system.h: Include "inttostr.h".
(timetostr): New function, factored out of...
* src/date.c (show_date): Use timetostr.
* src/du.c (show_date): Likewise.
* src/ls.c (print_long_format): Likewise.
* src/pinky.c (time_string): Likewise.
* src/stat.c (human_time): Likewise.
* src/*.c: Don't include inttostr.h, since system.h does.
* src/c99-to-c89.diff: Adjust offsets.
Diffstat (limited to 'src/stat.c')
-rw-r--r-- | src/stat.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/stat.c b/src/stat.c index 0124c545e..a97687a87 100644 --- a/src/stat.c +++ b/src/stat.c @@ -62,7 +62,6 @@ #include "file-type.h" #include "fs.h" #include "getopt.h" -#include "inttostr.h" #include "quote.h" #include "quotearg.h" #include "stat-time.h" @@ -415,9 +414,7 @@ human_time (struct timespec t) + sizeof "-MM-DD HH:MM:SS.NNNNNNNNN +ZZZZ"))]; struct tm const *tm = localtime (&t.tv_sec); if (tm == NULL) - return (TYPE_SIGNED (time_t) - ? imaxtostr (t.tv_sec, str) - : umaxtostr (t.tv_sec, str)); + return timetostr (t.tv_sec, str); nstrftime (str, sizeof str, "%Y-%m-%d %H:%M:%S.%N %z", tm, 0, t.tv_nsec); return str; } |