]> Pileus Git - lackey/blobdiff - cals/ical.c
Add support for timezones
[lackey] / cals / ical.c
index b21cad0efb4f78852d41ccc9466810797be7d104..57fff1eb1e9a779dbbd02f182e1b6f649bc98511 100644 (file)
@@ -58,26 +58,14 @@ static int ical_compare(const void *_a, const void *_b)
               ecomp != 0 ? ecomp : 0 ;
 }
 
               ecomp != 0 ? ecomp : 0 ;
 }
 
-static date_t to_date(struct icaltimetype time)
+static date_t to_date(struct icaltimetype itime)
 {
 {
-       return (date_t){
-               .year  = time.year,
-               .month = time.month ? time.month-1 : 0,
-               .day   = time.day   ? time.day  -1 : 0,
-               .hour  = time.hour,
-               .min   = time.minute,
-       };
+       return get_date(icaltime_as_timet_with_zone(itime, itime.zone));
 }
 
 }
 
-static icaltimetype to_itime(date_t time)
+static icaltimetype to_itime(date_t date)
 {
 {
-       return (struct icaltimetype){
-               .year   = time.year,
-               .month  = time.month + 1,
-               .day    = time.day   + 1,
-               .hour   = time.hour,
-               .minute = time.min
-       };
+       return icaltime_from_timet_with_zone(get_stamp(date), 0, NULL);
 }
 
 static void add_recur(cal_t *cal,
 }
 
 static void add_recur(cal_t *cal,