[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC]: More automatic timezone info.

From: Adam Fedor
Subject: Re: [RFC]: More automatic timezone info.
Date: Wed, 3 Sep 2003 10:52:45 -0600

On Wednesday, September 3, 2003, at 10:46 AM, Fred Kiefer wrote:

Adam Fedor wrote:
This patches NSTimeZone to use a more standard (Posix?) method of
finding the time zone info that's already set on the computer. I think
many people could avoid having to set the "Local Time Zone" default.
Nice patch, what I don't understand is why you did add an #else branch. If tzset() fails we should still use the TZ environment variable.

tzset is supposed to use the TZ variable before checking other places, so the TZ check should be redundant in this case.


+      if (localZoneString == nil)
+       {
+         /*
+          * Try to get timezone from tzset and tzname
+          */
+         extern char *tzname[2];
+         tzset();
+         if (tzname[0] != NULL && *tzname[0] != '\0')
+           localZoneString = [NSString stringWithCString: tzname[0]];
+       }
       if (localZoneString == nil)
@@ -1131,6 +1144,7 @@ static NSMapTable *absolutes = 0;
          localZoneString = [[[NSProcessInfo processInfo]
            environment] objectForKey: @"TZ"];
       if (localZoneString != nil)
          zone = [defaultPlaceholderTimeZone initWithName: localZoneString];

reply via email to

[Prev in Thread] Current Thread [Next in Thread]