diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-01-17 23:41:41 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-01-17 23:41:41 (JST) |
commit | bb3cc0d9666553608b7c89aef84d21d3312ce488 (patch) | |
tree | 59d848b8d24c807b5f1c3c107d3e01d59e11c257 /ui-shared.c | |
parent | 9dde6d38e9fc273fc62386eeda0da2e89a2cebfc (diff) | |
download | cgit-bb3cc0d9666553608b7c89aef84d21d3312ce488.zip cgit-bb3cc0d9666553608b7c89aef84d21d3312ce488.tar.gz |
ui-shared: do not allow negative minutes
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>
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index 883866d..1ede2b0 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -596,6 +596,8 @@ void cgit_print_age(time_t t, time_t max_relative, const char *format) | |||
596 | return; | 596 | return; |
597 | time(&now); | 597 | time(&now); |
598 | secs = now - t; | 598 | secs = now - t; |
599 | if (secs < 0) | ||
600 | secs = 0; | ||
599 | 601 | ||
600 | if (secs > max_relative && max_relative >= 0) { | 602 | if (secs > max_relative && max_relative >= 0) { |
601 | cgit_print_date(t, format, ctx.cfg.local_time); | 603 | cgit_print_date(t, format, ctx.cfg.local_time); |