1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +03:00

bus-util: fix format of NextElapseUSecRealtime= and LastTriggerUSec=

Before this, `systemctl show` for calendar type timer unit outputs
something like below.
```
NextElapseUSecRealtime=48y 3w 3d 15h
NextElapseUSecMonotonic=0
LastTriggerUSec=48y 3w 3d 3h 41min 44.093095s
LastTriggerUSecMonotonic=0
```
As both NextElapseUSecRealtime= and LastTriggerUSec= are not timespan
but timestamp, this makes format these values by `format_timestamp()`.
This commit is contained in:
Yu Watanabe 2018-01-25 17:45:53 +09:00 committed by Lennart Poettering
parent a3a3b6131e
commit 68a4b89ca3

View File

@ -711,7 +711,7 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b
/* Yes, heuristics! But we can change this check /* Yes, heuristics! But we can change this check
* should it turn out to not be sufficient */ * should it turn out to not be sufficient */
if (endswith(name, "Timestamp")) { if (endswith(name, "Timestamp") || STR_IN_SET(name, "NextElapseUSecRealtime", "LastTriggerUSec")) {
char timestamp[FORMAT_TIMESTAMP_MAX], *t; char timestamp[FORMAT_TIMESTAMP_MAX], *t;
t = format_timestamp(timestamp, sizeof(timestamp), u); t = format_timestamp(timestamp, sizeof(timestamp), u);