From 0f0ab148c6d444316af10e6b4c7a60630fed45d3 Mon Sep 17 00:00:00 2001 From: Stefan Naewe Date: Fri, 1 Aug 2008 14:54:38 +0200 Subject: Added `local-time` option to cgitrc When `local-time` is set, commit, tag and patch timestamps will be printed in the servers timezone. Also, regardless of the value of `local-time`, these timestamps will now always show the timezone. Signed-off-by: Stefan Naewe Signed-off-by: Lars Hjemli --- ui-shared.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'ui-shared.c') diff --git a/ui-shared.c b/ui-shared.c index 4280a70..197ee37 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -353,14 +353,17 @@ void cgit_object_link(struct object *obj) html_link_close(); } -void cgit_print_date(time_t secs, char *format) +void cgit_print_date(time_t secs, char *format, int local_time) { char buf[64]; struct tm *time; if (!secs) return; - time = gmtime(&secs); + if(local_time) + time = localtime(&secs); + else + time = gmtime(&secs); strftime(buf, sizeof(buf)-1, format, time); html_txt(buf); } @@ -375,7 +378,7 @@ void cgit_print_age(time_t t, time_t max_relative, char *format) secs = now - t; if (secs > max_relative && max_relative >= 0) { - cgit_print_date(t, format); + cgit_print_date(t, format, ctx.cfg.local_time); return; } @@ -453,7 +456,7 @@ void cgit_print_docend() html_include(ctx.cfg.footer); else { html("\n"); } -- cgit v1.2.3-59-g8ed1b