List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 2/3] ui-shared: use common function in print_rel_date()
Date: Thu, 13 Aug 2015 12:24:33 +0100	[thread overview]
Message-ID: <287f04d5a7ec3f3c3557d79e2917324440251070.1439464935.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1439464935.git.john@keeping.me.uk>

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 ui-shared.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index a6d4b65..792f3ee 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);
 }
 
-- 
2.5.0.466.g9af26fa



  parent reply	other threads:[~2015-08-13 11:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 11:24 [PATCH 0/3] Fix date tooltips in the distant past john
2015-08-13 11:24 ` [PATCH 1/3] ui-shared: extract date formatting to a function john
2015-08-13 11:24 ` john [this message]
2015-08-13 11:24 ` [PATCH 3/3] ui-shared: show full date in tooltip if longer ago than max_relative john
2015-08-13 13:40 ` [PATCH 0/3] Fix date tooltips in the distant past Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=287f04d5a7ec3f3c3557d79e2917324440251070.1439464935.git.john@keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).