From: Wilfried Göesgens Date: Thu, 11 Oct 2007 17:37:14 +0000 (+0000) Subject: * for some reason copying an event from our calendar seems to be the better way to... X-Git-Tag: v7.86~2981 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=dc4b7a9fbfd2b66eec71da545d82c9fa3dbf8ac6 * for some reason copying an event from our calendar seems to be the better way to init the struct tm we want to compare with later. --- diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index da379d2ce..f09b6109b 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -52,7 +52,6 @@ void calendar_month_view_display_events(time_t thetime) { Cal = &WCC->disp_cal[i]; all_day_event = Cal->start_hour == -1; show_event = thetime == Cal->start_day; - if (Cal->multi_day_event) { // are we in the range of the event? @@ -301,6 +300,9 @@ void calendar_month_view(int year, int month, int day) { * First, back up to the 1st of the month... */ memset(&starting_tm, 0, sizeof(struct tm)); + if (WC->num_cal > 0) + localtime_r(&WC->disp_cal[0].start_day, &starting_tm); + starting_tm.tm_year = year - 1900; starting_tm.tm_mon = month - 1; starting_tm.tm_mday = day; @@ -734,10 +736,13 @@ void calendar_day_view(int year, int month, int day) { /** Today's date */ memset(&d_tm, 0, sizeof d_tm); + if (WC->num_cal > 0) + localtime_r(&WC->disp_cal[0].start_day, &d_tm); + d_tm.tm_year = year - 1900; d_tm.tm_mon = month - 1; d_tm.tm_mday = day; - gmtime_r(&today_t, &d_tm); + today_t = mktime(&d_tm); /** Figure out the dates for "yesterday" and "tomorrow" links */ diff --git a/webcit/fmt_date.c b/webcit/fmt_date.c index 578ca9875..2b66b0e3b 100644 --- a/webcit/fmt_date.c +++ b/webcit/fmt_date.c @@ -29,7 +29,7 @@ size_t wc_strftime(char *s, size_t max, const char *format, const struct tm *tm) if (wc_locales[WC->selected_language] == NULL) { return strftime(s, max, format, tm); } - else { + else { // TODO: this gives empty strings on debian. return strftime_l(s, max, format, tm, wc_locales[WC->selected_language]); } #else @@ -56,13 +56,13 @@ void fmt_date(char *buf, time_t thetime, int brief) today_timet = time(NULL); localtime_r(&today_timet, &today_tm); - localtime_r(&thetime, &tm); + localtime_r(&thetime, &tm);/* hour = tm.tm_hour; if (hour == 0) hour = 12; else if (hour > 12) hour = hour - 12; - + */ buf[0] = 0; if (brief) {