X-Git-Url: http://pileus.org/git/?p=lackey;a=blobdiff_plain;f=cals%2Fical.c;fp=cals%2Fical.c;h=57fff1eb1e9a779dbbd02f182e1b6f649bc98511;hp=b21cad0efb4f78852d41ccc9466810797be7d104;hb=39c440444ff38c0e1702209c67cf018b92c71882;hpb=11458d86386ce37543f7fa26512de15db703df75 diff --git a/cals/ical.c b/cals/ical.c index b21cad0..57fff1e 100644 --- a/cals/ical.c +++ b/cals/ical.c @@ -58,26 +58,14 @@ static int ical_compare(const void *_a, const void *_b) 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,