html_txt(info->author);
cgit_close_filter(ctx.repo->email_filter);
html("</td><td colspan='2'>");
- cgit_print_age(info->commit->date, -1);
+ cgit_print_age(info->committer_date, info->committer_tz, -1);
} else {
html("</td><td></td><td>");
cgit_object_link(ref->object);
html("</td><td colspan='2'>");
if (info) {
if (info->tagger_date > 0)
- cgit_print_age(info->tagger_date, -1);
+ cgit_print_age(info->tagger_date, info->tagger_tz, -1);
} else if (ref->object->type == OBJ_COMMIT) {
- cgit_print_age(ref->commit->commit->date, -1);
+ cgit_print_age(ref->commit->commit->date, 0, -1);
}
html("</td></tr>\n");
return &mode;
}
-static void print_rel_date(time_t t, double value,
+static void print_rel_date(time_t t, int tz, double value,
const char *class, const char *suffix)
{
htmlf("<span class='%s' title='", class);
- html_attr(fmt_date(t, FMT_LONGDATE, ctx.cfg.local_time));
+ html_attr(show_date(t, tz, cgit_date_mode(FMT_LONGDATE)));
htmlf("'>%.0f %s</span>", value, suffix);
}
-void cgit_print_age(time_t t, time_t max_relative)
+void cgit_print_age(time_t t, int tz, time_t max_relative)
{
time_t now, secs;
if (secs > max_relative && max_relative >= 0) {
html("<span title='");
- html_attr(fmt_date(t, FMT_LONGDATE, ctx.cfg.local_time));
+ html_attr(show_date(t, tz, cgit_date_mode(FMT_LONGDATE)));
html("'>");
- cgit_print_date(t, FMT_SHORTDATE, ctx.cfg.local_time);
+ html_txt(show_date(t, tz, cgit_date_mode(FMT_SHORTDATE)));
html("</span>");
return;
}
if (secs < TM_HOUR * 2) {
- print_rel_date(t, secs * 1.0 / TM_MIN, "age-mins", "min.");
+ print_rel_date(t, tz, secs * 1.0 / TM_MIN, "age-mins", "min.");
return;
}
if (secs < TM_DAY * 2) {
- print_rel_date(t, secs * 1.0 / TM_HOUR, "age-hours", "hours");
+ print_rel_date(t, tz, secs * 1.0 / TM_HOUR, "age-hours", "hours");
return;
}
if (secs < TM_WEEK * 2) {
- print_rel_date(t, secs * 1.0 / TM_DAY, "age-days", "days");
+ print_rel_date(t, tz, secs * 1.0 / TM_DAY, "age-days", "days");
return;
}
if (secs < TM_MONTH * 2) {
- print_rel_date(t, secs * 1.0 / TM_WEEK, "age-weeks", "weeks");
+ print_rel_date(t, tz, secs * 1.0 / TM_WEEK, "age-weeks", "weeks");
return;
}
if (secs < TM_YEAR * 2) {
- print_rel_date(t, secs * 1.0 / TM_MONTH, "age-months", "months");
+ print_rel_date(t, tz, secs * 1.0 / TM_MONTH, "age-months", "months");
return;
}
- print_rel_date(t, secs * 1.0 / TM_YEAR, "age-years", "years");
+ print_rel_date(t, tz, secs * 1.0 / TM_YEAR, "age-years", "years");
}
void cgit_print_http_headers(void)
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_age(time_t t, int tz, time_t max_relative);
extern void cgit_print_http_headers(void);
extern void cgit_redirect(const char *url, bool permanent);
extern void cgit_print_docstart(void);