]> git.cameronkatri.com Git - cgit.git/commitdiff
ui-shared: do not allow negative minutes
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 17 Jan 2014 14:41:41 +0000 (15:41 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 17 Jan 2014 14:41:41 +0000 (15:41 +0100)
Do to timestamp differences, sometimes cgit would should "-0 min", which
doesn't make any sense.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
ui-shared.c

index 883866d8413fa917ca5e763ac6c7ea6b10c1157a..1ede2b0bbfa4a55c49311fde04d6a5a7765d8362 100644 (file)
@@ -596,6 +596,8 @@ void cgit_print_age(time_t t, time_t max_relative, const char *format)
                return;
        time(&now);
        secs = now - t;
+       if (secs < 0)
+               secs = 0;
 
        if (secs > max_relative && max_relative >= 0) {
                cgit_print_date(t, format, ctx.cfg.local_time);