From 20f383e85facdf1a42179880299dabe14ce39d62 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 9 Mar 2010 17:08:22 +0000 Subject: [PATCH] Monotone-Parent: a7332f5374e76477d1df1d08f12d1fc7f06af1a7 Monotone-Revision: 6028d3796190e7455c99c97ec20d3ccffbbcf28a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-03-09T17:08:22 Monotone-Branch: ca.inverse.sogo --- SOPE/NGCards/ChangeLog | 5 +++++ SOPE/NGCards/iCalTimeZone.m | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index b74626387..a6663c5df 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,5 +1,10 @@ 2010-03-09 Wolfgang Sourdeau + * iCalTimeZone.m (-periodForDate:): the order in which daylight + and standard occur is not the same in the northern and southern + hemisphere. We were thus choosing the wrong period for southern + areas. + * iCalTimeZonePeriod.m (_occurenceForDate:byRRule:): fixed computing of timezone switch dates, which were offset by one week too early. diff --git a/SOPE/NGCards/iCalTimeZone.m b/SOPE/NGCards/iCalTimeZone.m index be82b997c..9de729ff5 100644 --- a/SOPE/NGCards/iCalTimeZone.m +++ b/SOPE/NGCards/iCalTimeZone.m @@ -166,13 +166,26 @@ static NSMutableDictionary *cache; period = (iCalTimeZonePeriod *) [self uniqueChildWithTag: @"daylight"]; else if (!daylightOccurence) period = (iCalTimeZonePeriod *) [self uniqueChildWithTag: @"standard"]; - else if ([date earlierDate: daylightOccurence] == date - || [date earlierDate: standardOccurence] == standardOccurence) - period = (iCalTimeZonePeriod *) [self uniqueChildWithTag: @"standard"]; + else if ([date earlierDate: daylightOccurence] == date) + { + if ([date earlierDate: standardOccurence] == date + && ([standardOccurence earlierDate: daylightOccurence] + == standardOccurence)) + period = (iCalTimeZonePeriod *) [self uniqueChildWithTag: @"daylight"]; + else + period = (iCalTimeZonePeriod *) [self uniqueChildWithTag: @"standard"]; + } else - period = (iCalTimeZonePeriod *) [self uniqueChildWithTag: @"daylight"]; + { + if ([standardOccurence earlierDate: date] == standardOccurence + && ([daylightOccurence earlierDate: standardOccurence] + == daylightOccurence)) + period = (iCalTimeZonePeriod *) [self uniqueChildWithTag: @"standard"]; + else + period = (iCalTimeZonePeriod *) [self uniqueChildWithTag: @"daylight"]; + } -// NSLog (@"chosen period: '%@'", [period tag]); + // NSLog (@"chosen period: '%@'", [period tag]); return period; }