about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2015-08-13 12:24:33 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2015-08-13 15:40:12 +0200
commitb44dd95f13f039cd9bee301655150ff765d9555e (patch)
treeac36681c32c81601bec4f0dfa6f263b82053e2c0
parentui-shared: extract date formatting to a function (diff)
downloadcgit-pink-b44dd95f13f039cd9bee301655150ff765d9555e.tar.gz
cgit-pink-b44dd95f13f039cd9bee301655150ff765d9555e.zip
ui-shared: use common function in print_rel_date()
Signed-off-by: John Keeping <john@keeping.me.uk>
-rw-r--r--ui-shared.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 19cd521..bbb277a 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -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);
 }