diff options
Diffstat (limited to 'lib/libc/time/asctime.c')
-rw-r--r-- | lib/libc/time/asctime.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/libc/time/asctime.c b/lib/libc/time/asctime.c index a70ae4b6d3d..f05a428aef7 100644 --- a/lib/libc/time/asctime.c +++ b/lib/libc/time/asctime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asctime.c,v 1.14 2006/02/18 21:54:17 millert Exp $ */ +/* $OpenBSD: asctime.c,v 1.15 2007/02/06 19:35:16 millert Exp $ */ /* ** This file is in the public domain, so clarified as of ** 1996-06-05 by Arthur David Olson. @@ -19,7 +19,8 @@ /* ** Some systems only handle "%.2d"; others only handle "%02d"; ** "%02.2d" makes (most) everybody happy. -** At least some versions of gcc warn about the %02.2d; ignore the warning. +** At least some versions of gcc warn about the %02.2d; +** we conditionalize below to avoid the warning. */ /* ** All years associated with 32-bit time_t values are exactly four digits long; @@ -33,14 +34,22 @@ ** The ISO C 1999 and POSIX 1003.1-2004 standards prohibit padding the year, ** but many implementations pad anyway; most likely the standards are buggy. */ +#ifdef __GNUC__ +#define ASCTIME_FMT "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %-4s\n" +#else /* !defined __GNUC__ */ #define ASCTIME_FMT "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n" +#endif /* !defined __GNUC__ */ /* ** For years that are more than four digits we put extra spaces before the year ** so that code trying to overwrite the newline won't end up overwriting ** a digit within a year and truncating the year (operating on the assumption ** that no output is better than wrong output). */ +#ifdef __GNUC__ +#define ASCTIME_FMT_B "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %s\n" +#else /* !defined __GNUC__ */ #define ASCTIME_FMT_B "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %s\n" +#endif /* !defined __GNUC__ */ #define STD_ASCTIME_BUF_SIZE 26 /* |