aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 923d102..3ce86fe 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -636,15 +636,15 @@ const struct date_mode *cgit_date_mode(const char *format)
636 return &mode; 636 return &mode;
637} 637}
638 638
639static void print_rel_date(time_t t, double value, 639static void print_rel_date(time_t t, int tz, double value,
640 const char *class, const char *suffix) 640 const char *class, const char *suffix)
641{ 641{
642 htmlf("<span class='%s' title='", class); 642 htmlf("<span class='%s' title='", class);
643 html_attr(fmt_date(t, FMT_LONGDATE, ctx.cfg.local_time)); 643 html_attr(show_date(t, tz, cgit_date_mode(FMT_LONGDATE)));
644 htmlf("'>%.0f %s</span>", value, suffix); 644 htmlf("'>%.0f %s</span>", value, suffix);
645} 645}
646 646
647void cgit_print_age(time_t t, time_t max_relative) 647void cgit_print_age(time_t t, int tz, time_t max_relative)
648{ 648{
649 time_t now, secs; 649 time_t now, secs;
650 650
@@ -657,34 +657,34 @@ void cgit_print_age(time_t t, time_t max_relative)
657 657
658 if (secs > max_relative && max_relative >= 0) { 658 if (secs > max_relative && max_relative >= 0) {
659 html("<span title='"); 659 html("<span title='");
660 html_attr(fmt_date(t, FMT_LONGDATE, ctx.cfg.local_time)); 660 html_attr(show_date(t, tz, cgit_date_mode(FMT_LONGDATE)));
661 html("'>"); 661 html("'>");
662 cgit_print_date(t, FMT_SHORTDATE, ctx.cfg.local_time); 662 html_txt(show_date(t, tz, cgit_date_mode(FMT_SHORTDATE)));
663 html("</span>"); 663 html("</span>");
664 return; 664 return;
665 } 665 }
666 666
667 if (secs < TM_HOUR * 2) { 667 if (secs < TM_HOUR * 2) {
668 print_rel_date(t, secs * 1.0 / TM_MIN, "age-mins", "min."); 668 print_rel_date(t, tz, secs * 1.0 / TM_MIN, "age-mins", "min.");
669 return; 669 return;
670 } 670 }
671 if (secs < TM_DAY * 2) { 671 if (secs < TM_DAY * 2) {
672 print_rel_date(t, secs * 1.0 / TM_HOUR, "age-hours", "hours"); 672 print_rel_date(t, tz, secs * 1.0 / TM_HOUR, "age-hours", "hours");
673 return; 673 return;
674 } 674 }
675 if (secs < TM_WEEK * 2) { 675 if (secs < TM_WEEK * 2) {
676 print_rel_date(t, secs * 1.0 / TM_DAY, "age-days", "days"); 676 print_rel_date(t, tz, secs * 1.0 / TM_DAY, "age-days", "days");
677 return; 677 return;
678 } 678 }
679 if (secs < TM_MONTH * 2) { 679 if (secs < TM_MONTH * 2) {
680 print_rel_date(t, secs * 1.0 / TM_WEEK, "age-weeks", "weeks"); 680 print_rel_date(t, tz, secs * 1.0 / TM_WEEK, "age-weeks", "weeks");
681 return; 681 return;
682 } 682 }
683 if (secs < TM_YEAR * 2) { 683 if (secs < TM_YEAR * 2) {
684 print_rel_date(t, secs * 1.0 / TM_MONTH, "age-months", "months"); 684 print_rel_date(t, tz, secs * 1.0 / TM_MONTH, "age-months", "months");
685 return; 685 return;
686 } 686 }
687 print_rel_date(t, secs * 1.0 / TM_YEAR, "age-years", "years"); 687 print_rel_date(t, tz, secs * 1.0 / TM_YEAR, "age-years", "years");
688} 688}
689 689
690void cgit_print_http_headers(void) 690void cgit_print_http_headers(void)