From 84680074b11f7a20f8e1e76975321b6daf706966 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 5 Sep 2000 19:21:11 +0000 Subject: Compute the event duration using the event start/end times, not the 2000-09-05 JP Rosevear * cal-util/cal-recur.c (cal_recur_generate_instances): Compute the event duration using the event start/end times, not the interval times. svn path=/trunk/; revision=5199 --- calendar/ChangeLog | 6 ++++++ calendar/cal-util/cal-recur.c | 25 ++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 82e29699aa..1254f8d3ea 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2000-09-05 JP Rosevear + + * cal-util/cal-recur.c (cal_recur_generate_instances): Compute + the event duration using the event start/end times, not the + interval times. + 2000-09-05 JP Rosevear * cal-util/cal-recur.c (cal_recur_from_icalrecurrencetype): Check diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c index 5839dccace..cfd3011c0a 100644 --- a/calendar/cal-util/cal-recur.c +++ b/calendar/cal-util/cal-recur.c @@ -463,9 +463,9 @@ cal_recur_generate_instances (CalComponent *comp, gpointer cb_data) { CalComponentDateTime dtstart, dtend; - time_t dtstart_time; + time_t dtstart_time, dtend_time; GSList *rrules, *rdates, *exrules, *exdates; - CalObjTime interval_start, interval_end, event_start; + CalObjTime interval_start, interval_end, event_start, event_end; CalObjTime chunk_start, chunk_end; gint days, seconds, year; @@ -484,6 +484,11 @@ cal_recur_generate_instances (CalComponent *comp, } dtstart_time = icaltime_as_timet (*dtstart.value); + if (dtend.value) + dtend_time = icaltime_as_timet (*dtend.value); + else + dtend_time = time_day_end (dtstart_time); + cal_component_get_rrule_list (comp, &rrules); cal_component_get_rdate_list (comp, &rdates); @@ -494,13 +499,6 @@ cal_recur_generate_instances (CalComponent *comp, intersects the given interval. */ if (!(rrules || rdates || exrules || exdates)) { - time_t dtend_time; - - if (dtend.value) - dtend_time = icaltime_as_timet (*dtend.value); - else - dtend_time = time_day_end (dtstart_time); - if ((end && dtstart_time < end && dtend_time > start) || (end == 0 && dtend_time > start)) { (* cb) (comp, dtstart_time, dtend_time, cb_data); @@ -514,13 +512,14 @@ cal_recur_generate_instances (CalComponent *comp, cal_object_time_from_time (&interval_end, end); cal_object_time_from_time (&event_start, dtstart_time); - + cal_object_time_from_time (&event_end, dtend_time); + /* Calculate the duration of the event, which we use for all occurrences. We can't just subtract start from end since that may be affected by daylight-saving time. We also don't want to just use the number of seconds, since leap seconds will then cause a problem. So we want a value of days + seconds. */ - cal_object_compute_duration (&interval_start, &interval_end, + cal_object_compute_duration (&event_start, &event_end, &days, &seconds); /* Expand the recurrence for each year between start & end, or until @@ -1169,11 +1168,11 @@ cal_obj_generate_set_default (RecurData *recur_data, CalObjTime *occ) { GArray *occs; -#if 0 + g_print ("Generating set for %i/%i/%i %02i:%02i:%02i\n", occ->day, occ->month, occ->year, occ->hour, occ->minute, occ->second); -#endif + /* We start with just the one time in the set. */ occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); g_array_append_vals (occs, occ, 1); -- cgit