diff options
author | phk <phk@FreeBSD.org> | 2006-02-04 14:35:01 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2006-02-04 14:35:01 +0000 |
commit | f8e9593b7e7c0cae673213ec132e6b7fbd97b4ea (patch) | |
tree | 8fc16984712585ca789940ec11fdf04167355c2d /lib/libc/stdio/xprintf_time.c | |
parent | 8ef4ce651a0b65bf5df1b59c2d659d2532084517 (diff) | |
download | FreeBSD-src-f8e9593b7e7c0cae673213ec132e6b7fbd97b4ea.zip FreeBSD-src-f8e9593b7e7c0cae673213ec132e6b7fbd97b4ea.tar.gz |
Remove spurious "union arg" from printf.h
Make sure to always print something in the alternate time format.
Diffstat (limited to 'lib/libc/stdio/xprintf_time.c')
-rw-r--r-- | lib/libc/stdio/xprintf_time.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/stdio/xprintf_time.c b/lib/libc/stdio/xprintf_time.c index f50edc3..81697f1 100644 --- a/lib/libc/stdio/xprintf_time.c +++ b/lib/libc/stdio/xprintf_time.c @@ -61,7 +61,7 @@ __printf_render_time(struct __printf_io *io, const struct printf_info *pi, const struct timeval *tv; struct timespec *ts; time_t *tp; - intmax_t t; + intmax_t t, tx; int i, prec, nsec; prec = 0; @@ -82,6 +82,7 @@ __printf_render_time(struct __printf_io *io, const struct printf_info *pi, const p = buf; if (pi->alt) { + tx = t; if (t >= YEAR) { p += sprintf(p, "%jdy", t / YEAR); t %= YEAR; @@ -98,7 +99,7 @@ __printf_render_time(struct __printf_io *io, const struct printf_info *pi, const p += sprintf(p, "%jdm", t / MINUTE); t %= MINUTE; } - if (t != 0) + if (t != 0 || tx == 0) p += sprintf(p, "%jds", t); } else { p += sprintf(p, "%jd", (intmax_t)t); |