X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/c0b59823035efc136a82a96094d164a979d9b2e9..b44dd95f13f039cd9bee301655150ff765d9555e:/ui-shared.c diff --git a/ui-shared.c b/ui-shared.c index 1292ac9..bbb277a 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -604,35 +604,31 @@ void cgit_submodule_link(const char *class, char *path, const char *rev) path[len - 1] = tail; } -void cgit_print_date(time_t secs, const char *format, int local_time) +static const char *fmt_date(time_t secs, const char *format, int local_time) { - char buf[64]; + static char buf[64]; struct tm *time; if (!secs) - return; + return ""; if (local_time) time = localtime(&secs); else time = gmtime(&secs); strftime(buf, sizeof(buf)-1, format, time); - html_txt(buf); + return buf; +} + +void cgit_print_date(time_t secs, const char *format, int local_time) +{ + html_txt(fmt_date(secs, format, 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("%.0f %s", value, suffix); }