From: Art Cancro Date: Thu, 13 Jul 2006 03:22:51 +0000 (+0000) Subject: When finding a non-UTC timestamp with no time X-Git-Tag: v7.86~3991 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=9322902633e3eb2034f6f469f570b682427a8c44 When finding a non-UTC timestamp with no time zone specified, convert from the local timezone to UTC. Currently it is hardcoded for the America/New_York timezone, but we will fix that. --- diff --git a/citadel/ical_dezonify.c b/citadel/ical_dezonify.c index 318a2ef63..06fdb19a1 100644 --- a/citadel/ical_dezonify.c +++ b/citadel/ical_dezonify.c @@ -27,6 +27,21 @@ #include #include "ical_dezonify.h" +icaltimezone *get_default_icaltimezone(void) { + + char *location = NULL; + icaltimezone *zone = NULL; + + location = "America/New_York"; + if (location) { + zone = icaltimezone_get_builtin_timezone (location); + } + if (!zone) + zone = icaltimezone_get_utc_timezone (); + + return zone; +} + /* * Back end function for ical_dezonify() @@ -90,11 +105,15 @@ void ical_dezonify_backend(icalcomponent *cal, t, icaltimezone_get_utc_timezone() ); - TheTime.is_utc = 1; } else { - lprintf(CTDL_DEBUG, " * Not UTC but no tzid found; WTF??\n"); + lprintf(CTDL_DEBUG, " * Converting default timezone to UTC.\n"); + icaltimezone_convert_time(&TheTime, + get_default_icaltimezone(), + icaltimezone_get_utc_timezone() + ); } + TheTime.is_utc = 1; } icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);