From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 3/8] ui-shared: add cgit_date_mode()
Date: Tue, 19 Jan 2016 19:33:03 +0000 [thread overview]
Message-ID: <402250326c49147ce0c04df29331d99ec08f245f.1453231719.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1453231719.git.john@keeping.me.uk>
This returns the correct mode value for use with Git's show_date() based
on the current CGit configuration and will be used in the following
patches.
Signed-off-by: John Keeping <john at keeping.me.uk>
---
ui-shared.c | 9 +++++++++
ui-shared.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/ui-shared.c b/ui-shared.c
index 34d3367..2a622cd 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -627,6 +627,15 @@ void cgit_print_date(time_t secs, const char *format, int local_time)
html_txt(fmt_date(secs, format, local_time));
}
+const struct date_mode *cgit_date_mode(const char *format)
+{
+ static struct date_mode mode;
+ mode.type = DATE_STRFTIME;
+ mode.strftime_fmt = format;
+ mode.local = ctx.cfg.local_time;
+ return &mode;
+}
+
static void print_rel_date(time_t t, double value,
const char *class, const char *suffix)
{
diff --git a/ui-shared.h b/ui-shared.h
index 4d655d9..7c097c1 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -61,6 +61,7 @@ __attribute__((format (printf,1,2)))
extern void cgit_print_error(const char *fmt, ...);
__attribute__((format (printf,1,0)))
extern void cgit_vprint_error(const char *fmt, va_list ap);
+extern const struct date_mode *cgit_date_mode(const char *format);
extern void cgit_print_date(time_t secs, const char *format, int local_time);
extern void cgit_print_age(time_t t, time_t max_relative);
extern void cgit_print_http_headers(void);
--
2.7.0.226.gfe986fe
next prev parent reply other threads:[~2016-01-19 19:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 19:33 [PATCH 0/8] Show times in the originator's timezone john
2016-01-19 19:33 ` [PATCH 1/8] ui-shared: remove "format" from cgit_print_age() john
2016-01-19 19:33 ` [PATCH 2/8] parsing: add timezone to ident structures john
2016-01-19 19:33 ` john [this message]
2016-02-08 13:20 ` [PATCH 3/8] ui-shared: add cgit_date_mode() Jason
2016-02-08 13:23 ` Jason
2016-01-19 19:33 ` [PATCH 4/8] ui-{commit,tag}: show dates in originator's timezone john
2016-01-19 19:33 ` [PATCH 5/8] ui: show ages in the " john
2016-01-19 19:33 ` [PATCH 6/8] ui-shared: use show_date for footer timestamp john
2016-01-19 19:33 ` [PATCH 7/8] ui-atom: use show_date directly for atom dates john
2016-01-19 19:33 ` [PATCH 8/8] ui-shared: remove cgit_print_date() john
2016-02-08 13:23 ` [PATCH 0/8] Show times in the originator's timezone Jason
2016-02-08 13:38 ` Jason
2016-02-08 14:08 ` john
2016-02-08 14:33 ` Jason
2016-02-08 15:05 ` [PATCH 1/2] Avoid DATE_STRFTIME for long/short dates john
2016-02-08 15:06 ` [PATCH 2/2] ui-atom: avoid DATE_STRFTIME john
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=402250326c49147ce0c04df29331d99ec08f245f.1453231719.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).