aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util/timeutil.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-08-02 09:08:52 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-08-02 09:08:52 +0800
commit4e5b1da82e7ada3667bfa47471defd5932afc405 (patch)
treea5405dd760a6fee1ce6edc7f3935b3ab38e47b3d /calendar/cal-util/timeutil.c
parent3ce00eb40ede3898fda426b3e125139ab84242b4 (diff)
downloadgsoc2013-evolution-4e5b1da82e7ada3667bfa47471defd5932afc405.tar
gsoc2013-evolution-4e5b1da82e7ada3667bfa47471defd5932afc405.tar.gz
gsoc2013-evolution-4e5b1da82e7ada3667bfa47471defd5932afc405.tar.bz2
gsoc2013-evolution-4e5b1da82e7ada3667bfa47471defd5932afc405.tar.lz
gsoc2013-evolution-4e5b1da82e7ada3667bfa47471defd5932afc405.tar.xz
gsoc2013-evolution-4e5b1da82e7ada3667bfa47471defd5932afc405.tar.zst
gsoc2013-evolution-4e5b1da82e7ada3667bfa47471defd5932afc405.zip
Use CalComponent and the new property types instead of the old iCalObject
2000-07-31 Federico Mena Quintero <federico@helixcode.com> * cal-util/cal-recur.c (*): Use CalComponent and the new property types instead of the old iCalObject stuff. (cal_recur_generate_instances): Renamed from cal_object_generate_events(). Ensure that the component has the DTSTART property. (generate_instances_for_year): Renamed from cal_object_generate_events_for_year(). (cal_obj_expand_recurrence): Made static. (cal_recur_from_icalrecurrencetype): New function. We should really convert this whole file to use struct icalrecurrencetype instead. (cal_recur_free): New function. * cal-util/cal-recur.h (CalRecurType): Renamed from CalObjRecurType. (CalRecurrence): Renamed from CalObjRecurrence. * cal-util/timeutil.c (time_from_icaltimetype): New function. * cal-util/Makefile.am: Commented out the test-recur program. svn path=/trunk/; revision=4464
Diffstat (limited to 'calendar/cal-util/timeutil.c')
-rw-r--r--calendar/cal-util/timeutil.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c
index f887a8df37..bbce9b82d6 100644
--- a/calendar/cal-util/timeutil.c
+++ b/calendar/cal-util/timeutil.c
@@ -10,6 +10,39 @@
#include <string.h>
#include "timeutil.h"
+
+
+/**
+ * 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