diff --git a/ChangeLog b/ChangeLog index 0755fe1c1..32a0b0957 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * Headers/Foundation/NSString.h: Add explicit warnings about OSX compatible modifications to values returned by path methods. + * Source/NSTimeZone.m: Don't guess at tzname[0] if the value of + daylight shows it's not valid. 2011-05-31 Niels Grewe diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index f1f8875f5..4721693cc 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -1526,13 +1526,16 @@ static NSMapTable *absolutes = 0; } #if HAVE_TZSET /* - * Try to get timezone from tzset and tzname + * Try to get timezone from tzset and tzname/daylight. + * If daylight is non-zero, then tzname[0] is only the name + * the the zone for part of the year, so we can't use it as + * the definitive zone. */ if (localZoneString == nil) { localZoneSource = @"function: 'tzset()/tzname'"; tzset(); - if (tzname[0] != NULL && *tzname[0] != '\0') + if (NULL != tzname[0] && '\0' != *tzname[0] && 0 == daylight) localZoneString = [NSString stringWithUTF8String: tzname[0]]; } #endif