From 20bba8a8f67d1e347d00748b03908f948c2be6b7 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Thu, 11 Mar 1999 01:35:52 +0000 Subject: 1999-03-10 Craig A Soules (soules+@andrew.cmu.edu) * timeutil.c, calendar.c, calobj.c, gncal-day-panel.c: Add support for daylight time savings. svn path=/trunk/; revision=756 --- calendar/cal-util/calobj.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'calendar/cal-util') diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index 6ed9db187a..db27f8abd3 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -1030,12 +1030,22 @@ generate (iCalObject *ico, time_t reference, calendarfn cb, void *closure) dt_end.tm_mon = ref.tm_mon; dt_end.tm_year = ref.tm_year; + + if (ref.tm_isdst > dt_start.tm_isdst){ + dt_start.tm_hour--; + dt_end.tm_hour--; + } else if (ref.tm_isdst < dt_start.tm_isdst){ + dt_start.tm_hour++; + dt_end.tm_hour++; + } + s_t = mktime (&dt_start); + if (ico->exdate && is_date_in_list (ico->exdate, &dt_start)) return 1; e_t = mktime (&dt_end); - + if ((s_t == -1) || (e_t == -1)) { g_warning ("Produced invalid dates!\n"); return 0; @@ -1131,9 +1141,10 @@ ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendar if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) { /* Weekdays to recur on are specified as a bitmask */ - if (ico->recur->weekday & (1 << tm->tm_wday)) + if (ico->recur->weekday & (1 << tm->tm_wday)) { if (!generate (ico, current, cb, closure)) return; + } } /* Advance by day for scanning the week or by interval at week end */ -- cgit v1.2.3