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/system.h | |
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/system.h')
-rw-r--r-- | src/system.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/system.h b/src/system.h index c69ddca34..4b8e58e1f 100644 --- a/src/system.h +++ b/src/system.h @@ -619,3 +619,13 @@ emit_bug_reporting_address (void) bugs (typically your translation team's web or email address). */ printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT); } + +#include "inttostr.h" + +static inline char * +timetostr (time_t t, char *buf) +{ + return (TYPE_SIGNED (time_t) + ? imaxtostr (t, buf) + : umaxtostr (t, buf)); +} |