summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-10-24 19:08:22 +0200
committerLennart Poettering <lennart@poettering.net>2014-10-24 19:08:22 +0200
commit65de0395ffe1cfb0f9af86504e8588fb31bb0fbc (patch)
tree19057a0fe603c149dfae93e267df1eb39ab6ae6b
parente73c78c27511b03c7abc55aed87896092c0de699 (diff)
time: earlier exit from format_timestamp_relative() on special times
-rw-r--r--src/shared/time-util.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 4d34362bce..43ad9db91e 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -219,11 +219,10 @@ char *format_timestamp_relative(char *buf, size_t l, usec_t t) {
const char *s;
usec_t n, d;
- n = now(CLOCK_REALTIME);
-
- if (t <= 0 || (t == USEC_INFINITY))
+ if (t <= 0 || t == USEC_INFINITY)
return NULL;
+ n = now(CLOCK_REALTIME);
if (n > t) {
d = n - t;
s = "ago";