bug-gnustep
[Top][All Lists]
Advanced

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

Re: [RFC]: More automatic timezone info.


From: Fred Kiefer
Subject: Re: [RFC]: More automatic timezone info.
Date: Wed, 03 Sep 2003 18:46:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

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.

Fred


+#if HAVE_TZSET
+      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]];
+       }
+#else
       if (localZoneString == nil)
        {
          /*
@@ -1131,6 +1144,7 @@ static NSMapTable *absolutes = 0;
          localZoneString = [[[NSProcessInfo processInfo]
            environment] objectForKey: @"TZ"];
        }
+#endif
       if (localZoneString != nil)
        {
          zone = [defaultPlaceholderTimeZone initWithName: localZoneString];





reply via email to

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