From 130ef6efcb903f2506ea1ab3b69906269bf34d10 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 12 Jul 2006 03:47:47 +0000 Subject: [PATCH] ical_dezonify: rearranged code and added log output to determine whether a timestamp is either (1) already UTC, (2) not UTC but included a time zone to convert from, or (3) not UTC but no timezone specified. Still need to handle (3) better, but we need to find a way to determine the current timezone. --- citadel/ical_dezonify.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/citadel/ical_dezonify.c b/citadel/ical_dezonify.c index ccc46d431..318a2ef63 100644 --- a/citadel/ical_dezonify.c +++ b/citadel/ical_dezonify.c @@ -79,14 +79,23 @@ void ical_dezonify_backend(icalcomponent *cal, return; } - /* Do the conversion. */ - if (t != NULL) { - icaltimezone_convert_time(&TheTime, - t, - icaltimezone_get_utc_timezone() - ); + if (TheTime.is_utc) { + lprintf(CTDL_DEBUG, " * This property is ALREADY UTC.\n"); + } + else { + /* Do the conversion. */ + if (t != NULL) { + lprintf(CTDL_DEBUG, " * Timezone prop found. Converting to UTC.\n"); + icaltimezone_convert_time(&TheTime, + t, + icaltimezone_get_utc_timezone() + ); + TheTime.is_utc = 1; + } + else { + lprintf(CTDL_DEBUG, " * Not UTC but no tzid found; WTF??\n"); + } } - TheTime.is_utc = 1; icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER); /* Now add the converted property back in. */ @@ -155,6 +164,8 @@ void ical_dezonify_recur(icalcomponent *cal, icalcomponent *rcal) { void ical_dezonify(icalcomponent *cal) { icalcomponent *vt = NULL; + lprintf(CTDL_DEBUG, "ical_dezonify() started\n"); + /* Convert all times to UTC */ ical_dezonify_recur(cal, cal); @@ -165,6 +176,7 @@ void ical_dezonify(icalcomponent *cal) { icalcomponent_free(vt); } + lprintf(CTDL_DEBUG, "ical_dezonify() completed\n"); } -- 2.30.2