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_sec */
for (i = 0; i < ELEMENTSOF(table); i++) {
bool done = false;
usec_t a, b;
- if (t == 0 || t < accuracy) {
- if (!something) {
- snprintf(p, l, "0");
- p[l-1] = 0;
- return p;
- }
+ if (t <= 0)
+ break;
+ if (t < accuracy && something)
break;
- }
if (t < table[i].usec)
continue;
l -= n;
p += n;
-
something = true;
}