How to get the Unixtime of an event?

Ken Murchison murch at andrew.cmu.edu
Sun Aug 14 14:23:21 PDT 2016


Try icaltime_as_timet_with_zone().  Are you trying to get localtime or UTC?


On 8/14/16 4:15 PM, Bastian Seeleib wrote:
> Hi all,
>
> i'm trying to get the unixtime of an event and having trouble with it, 
> could someone help me?
> Using the follwing function calls, i'm getting 1471941000 which is 2 
> hours later than expected.
>
> icalproperty *pt = icalcomponent_get_first_property(comp, 
> ICAL_DTSTART_PROPERTY);
> struct icaltimetype t = icalproperty_get_dtstart(pt);
> printf("%ld", icaltime_as_timet(t));
>
> The dates are defined as following:
>
> DTSTART;TZID="Central Europe":20160823T083000
> DTEND;TZID="Central Europe":20160823T103000
>
> The VTIMEZINE is set to:
>
> BEGIN:VTIMEZONE
> TZID:Central Europe
> BEGIN:STANDARD
> DTSTART:19501029T020000
> TZOFFSETFROM:+0200
> TZOFFSETTO:+0100
> RRULE:FREQ=YEARLY;BYMINUTE=0;BYHOUR=2;BYDAY=-1SU;BYMONTH=10
> END:STANDARD
> BEGIN:DAYLIGHT
> DTSTART:19500326T020000
> TZOFFSETFROM:+0100
> TZOFFSETTO:+0200
> RRULE:FREQ=YEARLY;BYMINUTE=0;BYHOUR=2;BYDAY=-1SU;BYMONTH=3
> END:DAYLIGHT
> END:VTIMEZONE
>
> To me it seems that the definition of VTIMEZONE is ignored.
>
>
> _______________________________________________
> libical-devel mailing list
> libical-devel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libical-devel


-- 
Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University




More information about the libical-devel mailing list