summaryrefslogtreecommitdiff
path: root/src/core/timer.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-04 02:56:56 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-04 02:56:56 +0200
commit2fa4092c2829dd14e50c430ae2f23551d23c6c1d (patch)
treeacc0b56b0f7f1f93afde6a0feb8f38c332236352 /src/core/timer.c
parent911963f1a29897eee2fffbe503ac05ec13028a30 (diff)
util: make time formatting a bit smarter
Instead of outputting "5h 55s 50ms 3us" we'll now output "5h 55.050003s". Also, while outputting the accuracy is configurable. Basically we now try use "dot notation" for all time values > 1min. For >= 1s we use 's' as unit, otherwise for >= 1ms we use 'ms' as unit, and finally 'us'. This should give reasonably values in most cases.
Diffstat (limited to 'src/core/timer.c')
-rw-r--r--src/core/timer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/timer.c b/src/core/timer.c
index 16b49174d..16ca57317 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -177,7 +177,7 @@ static void timer_dump(Unit *u, FILE *f, const char *prefix) {
"%s%s: %s\n",
prefix,
timer_base_to_string(v->base),
- strna(format_timespan(timespan1, sizeof(timespan1), v->value)));
+ strna(format_timespan(timespan1, sizeof(timespan1), v->value, 0)));
}
}
}
@@ -330,7 +330,7 @@ static void timer_enter_waiting(Timer *t, bool initial) {
log_debug_unit(UNIT(t)->id,
"%s: Monotonic timer elapses in %s.",
UNIT(t)->id,
- format_timespan(buf, sizeof(buf), t->next_elapse_monotonic > ts.monotonic ? t->next_elapse_monotonic - ts.monotonic : 0));
+ format_timespan(buf, sizeof(buf), t->next_elapse_monotonic > ts.monotonic ? t->next_elapse_monotonic - ts.monotonic : 0, 0));
r = unit_watch_timer(UNIT(t), CLOCK_MONOTONIC, false, t->next_elapse_monotonic, &t->monotonic_watch);
if (r < 0)