diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-04 21:18:06 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-04 21:18:06 +0200 |
commit | 552e4331bf165290eb02596355d9570c1ef9af47 (patch) | |
tree | 51031d5687e6e04858f8b1441e0b65da21fedbbf /src | |
parent | fae20b110fe8734440ebfbcb676838dffda60b1b (diff) |
systemctl: use format_timespan() where applicable
Diffstat (limited to 'src')
-rw-r--r-- | src/systemctl.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/systemctl.c b/src/systemctl.c index 72bb7d8044..226ecee3ad 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -1029,6 +1029,10 @@ static int print_property(const char *name, DBusMessageIter *iter) { if ((t = format_timestamp(timestamp, sizeof(timestamp), u)) || arg_all) printf("%s=%s\n", name, strempty(t)); + } else if (strstr(name, "USec")) { + char timespan[FORMAT_TIMESPAN_MAX]; + + printf("%s=%s\n", name, format_timespan(timespan, sizeof(timespan), u)); } else printf("%s=%llu\n", name, (unsigned long long) u); @@ -1165,11 +1169,14 @@ static int print_property(const char *name, DBusMessageIter *iter) { if (bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_STRING, &base, true) >= 0 && bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT64, &value, true) >= 0 && - bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT64, &next_elapse, false) >= 0) - printf("%s={ value=%llu ; next_elapse=%llu }\n", + bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT64, &next_elapse, false) >= 0) { + char timespan1[FORMAT_TIMESPAN_MAX], timespan2[FORMAT_TIMESPAN_MAX]; + + printf("%s={ value=%s ; next_elapse=%s }\n", base, - (unsigned long long) value, - (unsigned long long) next_elapse); + format_timespan(timespan1, sizeof(timespan1), value), + format_timespan(timespan2, sizeof(timespan2), next_elapse)); + } dbus_message_iter_next(&sub); } |