- /** Do the conversion. */
- if (t != NULL) {
- icaltimezone_convert_time(&TheTime,
- t,
- icaltimezone_get_utc_timezone()
- );
+#ifdef DBG_ICAL
+ syslog(LOG_DEBUG, "ical_dezonify: was: %s\n", icaltime_as_ical_string(TheTime));
+#endif
+
+ if (icaltime_is_utc(TheTime)) {
+#ifdef DBG_ICAL
+ syslog(LOG_DEBUG, "ical_dezonify: this property is ALREADY UTC");
+#endif
+ }
+
+ else if (utc_declared_as_tzid) {
+#ifdef DBG_ICAL
+ syslog(LOG_DEBUG, "ical_dezonify: replacing '%s' TZID with 'Z' suffix", tzid);
+#endif
+ TheTime.zone = icaltimezone_get_utc_timezone();
+ }
+
+ else {
+ // Do the conversion.
+ if (t != NULL) {
+#ifdef DBG_ICAL
+ syslog(LOG_DEBUG, "ical_dezonify: timezone prop found, converting to UTC");
+#endif
+ }
+ else {
+#ifdef DBG_ICAL
+ syslog(LOG_DEBUG, "ical_dezonify: converting default timezone to UTC");
+#endif
+ }
+
+ if (t == NULL) {
+ t = get_default_icaltimezone();
+ }
+ icaltimezone_convert_time(&TheTime, t, icaltimezone_get_utc_timezone());
+ TheTime.zone = icaltimezone_get_utc_timezone();