summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Zeller <luz@synthesis.ch>2009-05-05 17:59:39 +0200
committerLukas Zeller <luz@synthesis.ch>2009-05-05 17:59:39 +0200
commit8dcbb893b8d5f782a37a58748859b6d8c5e613b9 (patch)
tree61f3967111e65428c2282a74d10021f4b36a0a22
parent037179bc0a0aef9dc88e0dd94e59f69fb9c07239 (diff)
vCalendar 1.0 TZ parsing: now searches in internal zone list
Before, a TZ without a subsequent DAYLIGHT in a vCalendar 1.0 was not attempted to convert into a known time zone from the internal list, but was left a plain minute offset. This fallback type of internal time zone representation is not desirable, so we now try to find a matching internal time zone even if no DAYLIGHT property is found. For example, UTC is detected as such from a TZ:+00:00 now.
-rw-r--r--src/sysync/mimedirprofile.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/sysync/mimedirprofile.cpp b/src/sysync/mimedirprofile.cpp
index ff20015..38753e8 100644
--- a/src/sysync/mimedirprofile.cpp
+++ b/src/sysync/mimedirprofile.cpp
@@ -3175,16 +3175,26 @@ bool TMimeDirProfileHandler::MIMEStringToField(
case CONVMODE_TZ:
// parse time zone
if (ISO8601StrToContext(aText, tctx)!=0) {
- // this is always global for the entire item, so set the item context
- // (which is then used when parsing dates (which should be delayed to make sure TZ is seen first)
+ // Note: this is always global for the entire item, so set the item context
+ // (which is then used when parsing dates (which should be delayed to make sure TZ is seen first)
fItemTimeContext = tctx;
+ if (!TCTX_IS_TZ(tctx)) {
+ // only offset. Try to symbolize it by passing a DAYLIGHT:FALSE and the offset
+ if (TzDaylightToContext("FALSE", fItemTimeContext, tctx, getSessionZones(), fReceiverTimeContext))
+ fItemTimeContext = tctx; // there is a symbolized context, keep that
+ }
fHasExplicitTZ = true; // zone explicitly set, not only copied from session's user zone
goto timecontext;
}
return true; // not set, is ok
case CONVMODE_DAYLIGHT:
// parse DAYLIGHT zone description property, prefer user zone (among multiple zones matching the Tz/daylight info)
- if (TzDaylightToContext(aText,fItemTimeContext,tctx,getSessionZones(),fReceiverTimeContext)) {
+ // - resolve to offset (assuming that item context came from a TZ property, so it will
+ // be one of the non-DST zones, so reftime does not matter)
+ tctx = fItemTimeContext;
+ TzResolveContext(tctx, getSystemNowAs(TCTX_UTC, getSessionZones()), true, getSessionZones());
+ // - now find matching zone for given offset and DAYLIGHT property string
+ if (TzDaylightToContext(aText,tctx,tctx,getSessionZones(),fReceiverTimeContext)) {
// this is always global for the entire item, so set the item context
// (which is then used when parsing dates (which should be delayed to make sure TZ is seen first)
fItemTimeContext = tctx;