ICU-5610 Use <tzfile.h> for time zone path names when available
X-SVN-Rev: 21653
This commit is contained in:
parent
c22b3075b7
commit
e1ed2e9f2e
@ -597,8 +597,13 @@ extern U_IMPORT char *U_TZNAME[];
|
||||
#if !UCONFIG_NO_FILE_IO && (defined(U_DARWIN) || defined(U_LINUX) || defined(U_BSD))
|
||||
/* These platforms are likely to use Olson timezone IDs. */
|
||||
#define CHECK_LOCALTIME_LINK 1
|
||||
#define TZZONELINK "/etc/localtime"
|
||||
#if defined(U_LINUX)
|
||||
#define TZDEFAULT "/etc/localtime"
|
||||
#define TZZONEINFO "/usr/share/zoneinfo/"
|
||||
#else
|
||||
#include <tzfile.h>
|
||||
#define TZZONEINFO (TZDIR "/")
|
||||
#endif
|
||||
static char gTimeZoneBuffer[PATH_MAX];
|
||||
static char *gTimeZoneBufferPtr = NULL;
|
||||
#endif
|
||||
@ -757,7 +762,7 @@ uprv_tzname(int n)
|
||||
because the tzfile contents is underspecified.
|
||||
This isn't guaranteed to work because it may not be a symlink.
|
||||
*/
|
||||
int32_t ret = (int32_t)readlink(TZZONELINK, gTimeZoneBuffer, sizeof(gTimeZoneBuffer));
|
||||
int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer));
|
||||
if (0 < ret) {
|
||||
int32_t tzZoneInfoLen = uprv_strlen(TZZONEINFO);
|
||||
gTimeZoneBuffer[ret] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user