From a4789a176c9b256e018e31ac363ee9847da55500 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Mon, 28 Aug 2000 23:17:08 +0000 Subject: We no longer need time_from_icaltimetype as libical has the API for this 2000-08-28 JP Rosevear * cal-util/timeutil.h: We no longer need time_from_icaltimetype as libical has the API for this * cal-util/timeutil.c: ditto * cal-util/cal-recur.c: Replace time_from_icaltimetype with icaltime_as_timet * gui/calendar-model.c: ditto * gui/event-editor.c: ditto * gui/gnome-cal.c: ditto svn path=/trunk/; revision=5090 --- calendar/ChangeLog | 16 ++++++++++++++++ calendar/cal-util/cal-recur.c | 10 +++++----- calendar/cal-util/timeutil.c | 31 ------------------------------- calendar/cal-util/timeutil.h | 1 - calendar/gui/calendar-model.c | 6 +++--- calendar/gui/event-editor.c | 8 ++++---- calendar/gui/gncal-todo.c | 6 +++--- 7 files changed, 31 insertions(+), 47 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5b3ba7b04a..a339ade968 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,19 @@ +2000-08-28 JP Rosevear + + * cal-util/timeutil.h: We no longer need time_from_icaltimetype + as libical has the API for this + + * cal-util/timeutil.c: ditto + + * cal-util/cal-recur.c: Replace time_from_icaltimetype with + icaltime_as_timet + + * gui/calendar-model.c: ditto + + * gui/event-editor.c: ditto + + * gui/gnome-cal.c: ditto + 2000-08-28 Federico Mena Quintero * pcs/cal-backend-file.c (remove_component): Remove the diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c index 164ffdbfc6..2fad53ca63 100644 --- a/calendar/cal-util/cal-recur.c +++ b/calendar/cal-util/cal-recur.c @@ -483,7 +483,7 @@ cal_recur_generate_instances (CalComponent *comp, goto out; } - dtstart_time = time_from_icaltimetype (*dtstart.value); + dtstart_time = icaltime_as_timet (*dtstart.value); cal_component_get_rrule_list (comp, &rrules); cal_component_get_rdate_list (comp, &rdates); @@ -497,7 +497,7 @@ cal_recur_generate_instances (CalComponent *comp, time_t dtend_time; if (dtend.value) - dtend_time = time_from_icaltimetype (*dtend.value); + dtend_time = icaltime_as_timet (*dtend.value); else dtend_time = time_day_end (dtstart_time); @@ -640,7 +640,7 @@ cal_recur_from_icalrecurrencetype (struct icalrecurrencetype *ir) /* FIXME: we don't deal with ir->count. Also, how does libical * distinguish between n-occurrences and until-some-date rules? */ - r->enddate = time_from_icaltimetype (ir->until); + r->enddate = icaltime_as_timet (ir->until); switch (ir->week_start) { case ICAL_MONDAY_WEEKDAY: @@ -787,7 +787,7 @@ generate_instances_for_year (CalComponent *comp, /* FIXME: this only deals with the start time */ period = elem->data; - t = time_from_icaltimetype (period->start); + t = icaltime_as_timet (period->start); cal_object_time_from_time (&cotime, t); g_array_append_val (occs, cotime); @@ -818,7 +818,7 @@ generate_instances_for_year (CalComponent *comp, /* FIXME: this only deals with the start time */ period = elem->data; - t = time_from_icaltimetype (period->start); + t = icaltime_as_timet (period->start); cal_object_time_from_time (&cotime, t); g_array_append_val (ex_occs, cotime); diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c index bbce9b82d6..1281e6fe92 100644 --- a/calendar/cal-util/timeutil.c +++ b/calendar/cal-util/timeutil.c @@ -12,37 +12,6 @@ -/** - * time_from_icaltimetype: - * @itt: A struct icaltimetype value. - * - * Converts a struct icaltimetype value into a time_t value. Does not deal with - * timezones. - * - * Return value: A time_t value. - **/ -time_t -time_from_icaltimetype (struct icaltimetype itt) -{ - struct tm tm; - - /* FIXME: this does not handle timezones */ - - memset (&tm, 0, sizeof (tm)); - - tm.tm_year = itt.year - 1900; - tm.tm_mon = itt.month - 1; - tm.tm_mday = itt.day; - - if (!itt.is_date) { - tm.tm_hour = itt.hour; - tm.tm_min = itt.minute; - tm.tm_sec = itt.second; - } - - return mktime (&tm); -} - #define digit_at(x,y) (x [y] - '0') time_t diff --git a/calendar/cal-util/timeutil.h b/calendar/cal-util/timeutil.h index 37b70ee6cf..b8fa6400d2 100644 --- a/calendar/cal-util/timeutil.h +++ b/calendar/cal-util/timeutil.h @@ -14,7 +14,6 @@ #include -time_t time_from_icaltimetype (struct icaltimetype itt); time_t time_from_isodate (char *str); time_t time_from_start_duration (time_t start, char *duration); char *isodate_from_time_t (time_t t); diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 9be00485b3..135f770863 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -353,7 +353,7 @@ get_completed (CalComponent *comp) if (!completed) t = 0; else { - t = time_from_icaltimetype (*completed); + t = icaltime_as_timet (*completed); cal_component_free_icaltimetype (completed); } @@ -369,7 +369,7 @@ get_and_free_datetime (CalComponentDateTime dt) if (!dt.value) t = 0; else - t = time_from_icaltimetype (*dt.value); + t = icaltime_as_timet (*dt.value); cal_component_free_datetime (&dt); @@ -599,7 +599,7 @@ get_is_overdue (CalComponent *comp) * really overdue? **/ - t = time_from_icaltimetype (*dt.value); + t = icaltime_as_timet (*dt.value); if (t < time (NULL)) retval = TRUE; diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 4e3d08e362..d29b67b7fd 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -723,9 +723,9 @@ fill_widgets (EventEditor *ee) 3rd Feb as the end date, since it really ends at midnight on 3rd, so we have to subtract a day so we only show the 2nd. */ cal_component_get_dtstart (priv->comp, &d); - dtstart = time_from_icaltimetype (*d.value); + dtstart = icaltime_as_timet (*d.value); cal_component_get_dtend (priv->comp, &d); - dtend = time_from_icaltimetype (*d.value); + dtend = icaltime_as_timet (*d.value); if (time_day_begin (dtstart) == dtstart && time_day_begin (dtend) == dtend) { dtend = time_add_day (dtend, -1); @@ -885,7 +885,7 @@ fill_widgets (EventEditor *ee) r->count); } } else { - time_t t = time_from_icaltimetype (r->until); + time_t t = icaltime_as_timet (r->until); e_dialog_toggle_set (priv->recurrence_ending_date_end_on, TRUE); /* Shorten by one day, as we store end-on date a day ahead */ /* FIXME is this correct? */ @@ -906,7 +906,7 @@ fill_widgets (EventEditor *ee) time_t ext; t = l->data; - ext = time_from_icaltimetype (*t); + ext = icaltime_as_timet (*t); append_exception (ee, ext); } cal_component_free_exdate_list (list); diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c index f81cc24740..3bd6839962 100644 --- a/calendar/gui/gncal-todo.c +++ b/calendar/gui/gncal-todo.c @@ -217,7 +217,7 @@ gncal_todo_edit (CalClient *client, CalComponent *comp) due_entry = gtk_entry_new (); cal_component_get_dtend (comp, &date); - d = time_from_icaltimetype (*date.value); + d = icaltime_as_timet (*date.value); due_entry = date_edit_new (d, TRUE); gtk_box_pack_start (GTK_BOX (due_box), due_entry, TRUE, TRUE, 0); gtk_widget_show (due_entry); @@ -717,7 +717,7 @@ insert_in_clist (GncalTodo *todo, CalComponent *comp) /* for right now all I'll do is up to the hours. */ cal_component_get_dtend (comp, &date); - time_remain = time_from_icaltimetype (*date.value) - time (NULL); + time_remain = icaltime_as_timet (*date.value) - time (NULL); if(time_remain < 0) { text[3] = "Overdue!"; } @@ -799,7 +799,7 @@ insert_in_clist (GncalTodo *todo, CalComponent *comp) */ cal_component_get_dtend (comp, &date); - d = time_from_icaltimetype (*date.value); + d = icaltime_as_timet (*date.value); if(todo_show_due_date) { text[1] = convert_time_t_to_char (d); -- cgit v1.2.3