summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-06 21:33:53 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-06 21:34:11 +0200
commit4502d22cb8a96d9059b02861b8074e4fadf2cab2 (patch)
tree00faa9aab6bbb8d497b41dfd4b5f74faced854f2
parentc593cfe164bbdd063b8e8504be14f758b1f0a8c3 (diff)
util: when formatting timestamps return '0' for 0 timestamps instead of empty string
-rw-r--r--src/util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index ee7749be5e..7281b703ab 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1936,6 +1936,12 @@ char *format_timespan(char *buf, size_t l, usec_t t) {
if (t == (usec_t) -1)
return NULL;
+ if (t == 0) {
+ snprintf(p, l, "0");
+ p[l-1] = 0;
+ return p;
+ }
+
/* The result of this function can be parsed with parse_usec */
for (i = 0; i < ELEMENTSOF(table); i++) {