diff options
author | John Keeping | 2016-01-19 19:33:03 +0000 |
---|---|---|
committer | Jason A. Donenfeld | 2016-02-08 14:21:34 +0100 |
commit | 360af46fac6fe79ec1868141a6c34b4c6b732ba0 (patch) | |
tree | d0fad8a5d40e6d1ab371d14ad0695838e936fcea | |
parent | 45c87ca1c32dcd5ffd4a681fadf05627d9ce7770 (diff) | |
download | cgit-360af46fac6fe79ec1868141a6c34b4c6b732ba0.tar.gz |
ui-shared: add cgit_date_mode()
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@keeping.me.uk>
Diffstat (limited to '')
-rw-r--r-- | ui-shared.c | 9 | ||||
-rw-r--r-- | ui-shared.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index 76aac60..923d102 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 c9413ed..707cec9 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); |