]> granicus.if.org Git - cgit/commitdiff
ui-shared: use common function in print_rel_date()
authorJohn Keeping <john@keeping.me.uk>
Thu, 13 Aug 2015 11:24:33 +0000 (12:24 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 13 Aug 2015 13:40:12 +0000 (15:40 +0200)
Signed-off-by: John Keeping <john@keeping.me.uk>
ui-shared.c

index 19cd52178cc22320ecb92ac6ffab8e90fb493ed3..bbb277afec66f6465ceb08bab6472f96f441324e 100644 (file)
@@ -627,17 +627,8 @@ void cgit_print_date(time_t secs, const char *format, int local_time)
 static void print_rel_date(time_t t, double value,
        const char *class, const char *suffix)
 {
-       char buf[64];
-       struct tm *time;
-
-       if (ctx.cfg.local_time)
-               time = localtime(&t);
-       else
-               time = gmtime(&t);
-       strftime(buf, sizeof(buf) - 1, FMT_LONGDATE, time);
-
        htmlf("<span class='%s' title='", class);
-       html_attr(buf);
+       html_attr(fmt_date(t, FMT_LONGDATE, ctx.cfg.local_time));
        htmlf("'>%.0f %s</span>", value, suffix);
 }