mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Use tzset to find timezone info.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17615 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
002578b3ec
commit
c8e8f215fc
5 changed files with 30 additions and 6 deletions
|
@ -54,6 +54,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "Foundation/NSArray.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSData.h"
|
||||
|
@ -1123,6 +1124,18 @@ static NSMapTable *absolutes = 0;
|
|||
localZoneString = [localZoneString stringByTrimmingSpaces];
|
||||
}
|
||||
}
|
||||
#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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue