From 9c15f3c6954e43c5ffd36230e666eccf112803f2 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Mon, 8 Feb 2016 15:05:54 +0000 Subject: Avoid DATE_STRFTIME for long/short dates Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since our existing FMT_LONGDATE and FMT_SHORTDATE are pretty-much perfect matches to DATE_ISO8601 and DATE_SHORT, switch to taking a date_mode_type directly in cgit_date_mode(). Signed-off-by: John Keeping --- ui-shared.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index d1f9249..03dcc08 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -607,11 +607,10 @@ void cgit_submodule_link(const char *class, char *path, const char *rev) path[len - 1] = tail; } -const struct date_mode *cgit_date_mode(const char *format) +const struct date_mode *cgit_date_mode(enum date_mode_type type) { static struct date_mode mode; - mode.type = DATE_STRFTIME; - mode.strftime_fmt = format; + mode.type = type; mode.local = ctx.cfg.local_time; return &mode; } @@ -620,7 +619,7 @@ static void print_rel_date(time_t t, int tz, double value, const char *class, const char *suffix) { htmlf("%.0f %s", value, suffix); } @@ -637,9 +636,9 @@ void cgit_print_age(time_t t, int tz, time_t max_relative) if (secs > max_relative && max_relative >= 0) { html(""); - html_txt(show_date(t, tz, cgit_date_mode(FMT_SHORTDATE))); + html_txt(show_date(t, tz, cgit_date_mode(DATE_SHORT))); html(""); return; } @@ -781,7 +780,7 @@ void cgit_print_docend(void) else { htmlf("\n"); } html(" \n"); -- cgit v1.2.3-70-g09d2