the repository which powers this website
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 <[email protected]>
Jason A. Donenfeld 2014-01-17
parent 9dde6d3 · commit bb3cc0d
-rw-r--r--ui-shared.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 883866d8..1ede2b0b 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)
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);