aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util
diff options
context:
space:
mode:
authorMatt Loper <matt@helixcode.com>2000-05-13 07:15:04 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-05-13 07:15:04 +0800
commit725e254d7220e46a1536a871689760b35a6fd6ce (patch)
treeaa8c9d3f3a3ed60463ecb93d0e15885c5cee1ac8 /calendar/cal-util
parent9268ab3217531bdd5ca478d71f678ad7093516eb (diff)
downloadgsoc2013-evolution-725e254d7220e46a1536a871689760b35a6fd6ce.tar.gz
gsoc2013-evolution-725e254d7220e46a1536a871689760b35a6fd6ce.tar.zst
gsoc2013-evolution-725e254d7220e46a1536a871689760b35a6fd6ce.zip
Added version and availability of required libunicode library.
2000-05-10 Matt Loper <matt@helixcode.com> * README: Added version and availability of required libunicode library. 2000-05-10 Dan Winship <danw@helixcode.com> * configure.in: Update versions needed for gnome-print, bonobo, and gtkhtml. 2000-05-10 Christopher James Lahey <clahey@helixcode.com> * HACKING: We need a HACKING file. 2000-05-10 Christopher James Lahey <clahey@helixcode.com> svn path=/trunk/; revision=3008
Diffstat (limited to 'calendar/cal-util')
-rw-r--r--calendar/cal-util/calobj.c65
1 files changed, 35 insertions, 30 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
index 5ef1f1bb5f..4a3afd81ec 100644
--- a/calendar/cal-util/calobj.c
+++ b/calendar/cal-util/calobj.c
@@ -1178,48 +1178,53 @@ is_date_in_list (GList *list, struct tm *date)
return 0;
}
-
-/* FIXME: Doesn't work with events >= 1 day. */
-static int
+/* Generates an event instance based on the reference time */
+static gboolean
generate (iCalObject *ico, time_t reference, calendarfn cb, void *closure)
{
- struct tm dt_start, dt_end, ref;
- time_t s_t, e_t;
-
- dt_start = *localtime (&ico->dtstart);
- dt_end = *localtime (&ico->dtend);
- ref = *localtime (&reference);
+ time_t offset;
+ struct tm tm_start, ref;
+ time_t start, end;
- dt_start.tm_mday = ref.tm_mday;
- dt_start.tm_mon = ref.tm_mon;
- dt_start.tm_year = ref.tm_year;
+ offset = ico->dtend - ico->dtstart;
- dt_end.tm_mday = ref.tm_mday;
- dt_end.tm_mon = ref.tm_mon;
- dt_end.tm_year = ref.tm_year;
+ tm_start = *localtime (&ico->dtstart);
+ ref = *localtime (&reference);
+ tm_start.tm_mday = ref.tm_mday;
+ tm_start.tm_mon = ref.tm_mon;
+ tm_start.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++;
+ start = mktime (&tm_start);
+ if (start == -1) {
+ g_message ("generate(): Produced invalid start date!");
+ return FALSE;
}
- s_t = mktime (&dt_start);
-
- if (ico->exdate && is_date_in_list (ico->exdate, &dt_start))
- return 1;
+ end = start + offset;
- e_t = mktime (&dt_end);
+#if 0
+ /* FIXME: I think this is not needed, since we are offsetting by full day values,
+ * and the times should remain the same --- if you have a daily appointment
+ * at 18:00, it is always at 18:00 even during daylight savings.
+ *
+ * However, what should happen on the exact change-of-savings day with
+ * appointments in the early morning hours?
+ */
- if ((s_t == -1) || (e_t == -1)) {
- g_warning ("Produced invalid dates!\n");
- return 0;
+ if (ref.tm_isdst > tm_start.tm_isdst) {
+ tm_start.tm_hour--;
+ tm_end.tm_hour--;
+ } else if (ref.tm_isdst < tm_start.tm_isdst) {
+ tm_start.tm_hour++;
+ tm_end.tm_hour++;
}
+#endif
+
+ if (ico->exdate && is_date_in_list (ico->exdate, &tm_start))
+ return TRUE;
- return (*cb) (ico, s_t, e_t, closure);
+ return (*cb) (ico, start, end, closure);
}
int