diff options
| -rw-r--r-- | cgit.h | 2 | ||||
| -rw-r--r-- | ui-commit.c | 4 | ||||
| -rw-r--r-- | ui-shared.c | 13 | ||||
| -rw-r--r-- | ui-shared.h | 2 | ||||
| -rw-r--r-- | ui-tag.c | 2 |
5 files changed, 10 insertions, 13 deletions
| @@ -32,8 +32,6 @@ | |||
| 32 | /* | 32 | /* |
| 33 | * Dateformats used on misc. pages | 33 | * Dateformats used on misc. pages |
| 34 | */ | 34 | */ |
| 35 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" | ||
| 36 | #define FMT_SHORTDATE "%Y-%m-%d" | ||
| 37 | #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" | 35 | #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" |
| 38 | 36 | ||
| 39 | 37 | ||
diff --git a/ui-commit.c b/ui-commit.c index e697571..099d294 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
| @@ -56,7 +56,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
| 56 | cgit_close_filter(ctx.repo->email_filter); | 56 | cgit_close_filter(ctx.repo->email_filter); |
| 57 | html("</td><td class='right'>"); | 57 | html("</td><td class='right'>"); |
| 58 | html_txt(show_date(info->author_date, info->author_tz, | 58 | html_txt(show_date(info->author_date, info->author_tz, |
| 59 | cgit_date_mode(FMT_LONGDATE))); | 59 | cgit_date_mode(DATE_ISO8601))); |
| 60 | html("</td></tr>\n"); | 60 | html("</td></tr>\n"); |
| 61 | html("<tr><th>committer</th><td>"); | 61 | html("<tr><th>committer</th><td>"); |
| 62 | cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit"); | 62 | cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit"); |
| @@ -68,7 +68,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
| 68 | cgit_close_filter(ctx.repo->email_filter); | 68 | cgit_close_filter(ctx.repo->email_filter); |
| 69 | html("</td><td class='right'>"); | 69 | html("</td><td class='right'>"); |
| 70 | html_txt(show_date(info->committer_date, info->committer_tz, | 70 | html_txt(show_date(info->committer_date, info->committer_tz, |
| 71 | cgit_date_mode(FMT_LONGDATE))); | 71 | cgit_date_mode(DATE_ISO8601))); |
| 72 | html("</td></tr>\n"); | 72 | html("</td></tr>\n"); |
| 73 | html("<tr><th>commit</th><td colspan='2' class='sha1'>"); | 73 | html("<tr><th>commit</th><td colspan='2' class='sha1'>"); |
| 74 | tmp = oid_to_hex(&commit->object.oid); | 74 | tmp = oid_to_hex(&commit->object.oid); |
diff --git a/ui-shared.c b/ui-shared.c index d1f9249..03dcc08 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
| @@ -607,11 +607,10 @@ void cgit_submodule_link(const char *class, char *path, const char *rev) | |||
| 607 | path[len - 1] = tail; | 607 | path[len - 1] = tail; |
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | const struct date_mode *cgit_date_mode(const char *format) | 610 | const struct date_mode *cgit_date_mode(enum date_mode_type type) |
| 611 | { | 611 | { |
| 612 | static struct date_mode mode; | 612 | static struct date_mode mode; |
| 613 | mode.type = DATE_STRFTIME; | 613 | mode.type = type; |
| 614 | mode.strftime_fmt = format; | ||
| 615 | mode.local = ctx.cfg.local_time; | 614 | mode.local = ctx.cfg.local_time; |
| 616 | return &mode; | 615 | return &mode; |
| 617 | } | 616 | } |
| @@ -620,7 +619,7 @@ static void print_rel_date(time_t t, int tz, double value, | |||
| 620 | const char *class, const char *suffix) | 619 | const char *class, const char *suffix) |
| 621 | { | 620 | { |
| 622 | htmlf("<span class='%s' title='", class); | 621 | htmlf("<span class='%s' title='", class); |
| 623 | html_attr(show_date(t, tz, cgit_date_mode(FMT_LONGDATE))); | 622 | html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601))); |
| 624 | htmlf("'>%.0f %s</span>", value, suffix); | 623 | htmlf("'>%.0f %s</span>", value, suffix); |
| 625 | } | 624 | } |
| 626 | 625 | ||
| @@ -637,9 +636,9 @@ void cgit_print_age(time_t t, int tz, time_t max_relative) | |||
| 637 | 636 | ||
| 638 | if (secs > max_relative && max_relative >= 0) { | 637 | if (secs > max_relative && max_relative >= 0) { |
| 639 | html("<span title='"); | 638 | html("<span title='"); |
| 640 | html_attr(show_date(t, tz, cgit_date_mode(FMT_LONGDATE))); | 639 | html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601))); |
| 641 | html("'>"); | 640 | html("'>"); |
| 642 | html_txt(show_date(t, tz, cgit_date_mode(FMT_SHORTDATE))); | 641 | html_txt(show_date(t, tz, cgit_date_mode(DATE_SHORT))); |
| 643 | html("</span>"); | 642 | html("</span>"); |
| 644 | return; | 643 | return; |
| 645 | } | 644 | } |
| @@ -781,7 +780,7 @@ void cgit_print_docend(void) | |||
| 781 | else { | 780 | else { |
| 782 | htmlf("<div class='footer'>generated by <a href='http://git.zx2c4.com/cgit/about/'>cgit %s</a> at ", | 781 | htmlf("<div class='footer'>generated by <a href='http://git.zx2c4.com/cgit/about/'>cgit %s</a> at ", |
| 783 | cgit_version); | 782 | cgit_version); |
| 784 | html_txt(show_date(time(NULL), 0, cgit_date_mode(FMT_LONGDATE))); | 783 | html_txt(show_date(time(NULL), 0, cgit_date_mode(DATE_ISO8601))); |
| 785 | html("</div>\n"); | 784 | html("</div>\n"); |
| 786 | } | 785 | } |
| 787 | html("</div> <!-- id=cgit -->\n"); | 786 | html("</div> <!-- id=cgit -->\n"); |
diff --git a/ui-shared.h b/ui-shared.h index 43789de..b457c97 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
| @@ -61,7 +61,7 @@ __attribute__((format (printf,1,2))) | |||
| 61 | extern void cgit_print_error(const char *fmt, ...); | 61 | extern void cgit_print_error(const char *fmt, ...); |
| 62 | __attribute__((format (printf,1,0))) | 62 | __attribute__((format (printf,1,0))) |
| 63 | extern void cgit_vprint_error(const char *fmt, va_list ap); | 63 | extern void cgit_vprint_error(const char *fmt, va_list ap); |
| 64 | extern const struct date_mode *cgit_date_mode(const char *format); | 64 | extern const struct date_mode *cgit_date_mode(enum date_mode_type type); |
| 65 | extern void cgit_print_age(time_t t, int tz, time_t max_relative); | 65 | extern void cgit_print_age(time_t t, int tz, time_t max_relative); |
| 66 | extern void cgit_print_http_headers(void); | 66 | extern void cgit_print_http_headers(void); |
| 67 | extern void cgit_redirect(const char *url, bool permanent); | 67 | extern void cgit_redirect(const char *url, bool permanent); |
| @@ -77,7 +77,7 @@ void cgit_print_tag(char *revname) | |||
| 77 | if (info->tagger_date > 0) { | 77 | if (info->tagger_date > 0) { |
| 78 | html("<tr><td>tag date</td><td>"); | 78 | html("<tr><td>tag date</td><td>"); |
| 79 | html_txt(show_date(info->tagger_date, info->tagger_tz, | 79 | html_txt(show_date(info->tagger_date, info->tagger_tz, |
| 80 | cgit_date_mode(FMT_LONGDATE))); | 80 | cgit_date_mode(DATE_ISO8601))); |
| 81 | html("</td></tr>\n"); | 81 | html("</td></tr>\n"); |
| 82 | } | 82 | } |
| 83 | if (info->tagger) { | 83 | if (info->tagger) { |
