From: Lennart Poettering Date: Fri, 24 Oct 2014 17:08:22 +0000 (+0200) Subject: time: earlier exit from format_timestamp_relative() on special times X-Git-Tag: v217~72 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=65de0395ffe1cfb0f9af86504e8588fb31bb0fbc time: earlier exit from format_timestamp_relative() on special times --- diff --git a/src/shared/time-util.c b/src/shared/time-util.c index 4d34362bc..43ad9db91 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";