mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
parent
932feb79b3
commit
f75817172f
@ -432,34 +432,34 @@ char *format_timestamp_relative(char *buf, size_t l, usec_t t) {
|
||||
if (d >= USEC_PER_YEAR) {
|
||||
usec_t years = d / USEC_PER_YEAR;
|
||||
usec_t months = (d % USEC_PER_YEAR) / USEC_PER_MONTH;
|
||||
|
||||
snprintf(buf, l, USEC_FMT " %s " USEC_FMT " %s %s",
|
||||
years,
|
||||
years == 1 ? "year" : "years",
|
||||
months,
|
||||
months == 1 ? "month" : "months",
|
||||
s);
|
||||
}
|
||||
else if (d >= USEC_PER_MONTH) {
|
||||
} else if (d >= USEC_PER_MONTH) {
|
||||
usec_t months = d / USEC_PER_MONTH;
|
||||
usec_t days = (d % USEC_PER_MONTH) / USEC_PER_DAY;
|
||||
|
||||
snprintf(buf, l, USEC_FMT " %s " USEC_FMT " %s %s",
|
||||
months,
|
||||
months == 1 ? "month" : "months",
|
||||
days,
|
||||
days == 1 ? "day" : "days",
|
||||
s);
|
||||
}
|
||||
else if (d >= USEC_PER_WEEK) {
|
||||
} else if (d >= USEC_PER_WEEK) {
|
||||
usec_t weeks = d / USEC_PER_WEEK;
|
||||
usec_t days = (d % USEC_PER_WEEK) / USEC_PER_DAY;
|
||||
|
||||
snprintf(buf, l, USEC_FMT " %s " USEC_FMT " %s %s",
|
||||
weeks,
|
||||
weeks == 1 ? "week" : "weeks",
|
||||
days,
|
||||
days == 1 ? "day" : "days",
|
||||
s);
|
||||
}
|
||||
else if (d >= 2*USEC_PER_DAY)
|
||||
} else if (d >= 2*USEC_PER_DAY)
|
||||
snprintf(buf, l, USEC_FMT " days %s", d / USEC_PER_DAY, s);
|
||||
else if (d >= 25*USEC_PER_HOUR)
|
||||
snprintf(buf, l, "1 day " USEC_FMT "h %s",
|
||||
|
Loading…
Reference in New Issue
Block a user