From ba720e4293f2177cf6a0c0f8094a82b44a661522 Mon Sep 17 00:00:00 2001 From: rfm Date: Wed, 1 Jun 2011 15:15:52 +0000 Subject: [PATCH] minor tweak to fallback git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33222 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 2 ++ Source/NSTimeZone.m | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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