mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-07 09:00:28 +00:00
Remove spurious "union arg" from printf.h
Make sure to always print something in the alternate time format.
This commit is contained in:
parent
c62ccf20b2
commit
8dcefe6112
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=155300
|
@ -29,8 +29,6 @@
|
||||||
#ifndef _PRINTF_H_
|
#ifndef _PRINTF_H_
|
||||||
#define _PRINTF_H_
|
#define _PRINTF_H_
|
||||||
|
|
||||||
union arg;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The API defined by glibc allows a renderer to take multiple arguments
|
* The API defined by glibc allows a renderer to take multiple arguments
|
||||||
* This is obviously usable for things like (ptr+len) pairs etc.
|
* This is obviously usable for things like (ptr+len) pairs etc.
|
||||||
|
|
|
@ -61,7 +61,7 @@ __printf_render_time(struct __printf_io *io, const struct printf_info *pi, const
|
||||||
struct timeval *tv;
|
struct timeval *tv;
|
||||||
struct timespec *ts;
|
struct timespec *ts;
|
||||||
time_t *tp;
|
time_t *tp;
|
||||||
intmax_t t;
|
intmax_t t, tx;
|
||||||
int i, prec, nsec;
|
int i, prec, nsec;
|
||||||
|
|
||||||
prec = 0;
|
prec = 0;
|
||||||
|
@ -82,6 +82,7 @@ __printf_render_time(struct __printf_io *io, const struct printf_info *pi, const
|
||||||
|
|
||||||
p = buf;
|
p = buf;
|
||||||
if (pi->alt) {
|
if (pi->alt) {
|
||||||
|
tx = t;
|
||||||
if (t >= YEAR) {
|
if (t >= YEAR) {
|
||||||
p += sprintf(p, "%jdy", t / YEAR);
|
p += sprintf(p, "%jdy", t / YEAR);
|
||||||
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);
|
p += sprintf(p, "%jdm", t / MINUTE);
|
||||||
t %= MINUTE;
|
t %= MINUTE;
|
||||||
}
|
}
|
||||||
if (t != 0)
|
if (t != 0 || tx == 0)
|
||||||
p += sprintf(p, "%jds", t);
|
p += sprintf(p, "%jds", t);
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p, "%jd", (intmax_t)t);
|
p += sprintf(p, "%jd", (intmax_t)t);
|
||||||
|
|
Loading…
Reference in a new issue