diff --git a/src/system/libroot/posix/time/Jamfile b/src/system/libroot/posix/time/Jamfile index ca90059300..044b245ff2 100644 --- a/src/system/libroot/posix/time/Jamfile +++ b/src/system/libroot/posix/time/Jamfile @@ -1,7 +1,8 @@ SubDir HAIKU_TOP src system libroot posix time ; # for localtime.c strftime.c -SubDirCcFlags -DNOID -DTZDIR='\"/etc/timezones\"' -DUSG_COMPAT -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DPCTS=1 -DSTD_INSPIRED ; +SubDirCcFlags -DNOID -DTZDIR='get_timezones_directory()' -DUSG_COMPAT + -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -DPCTS=1 -DSTD_INSPIRED ; UsePrivateHeaders [ FDirName libroot time ] ; UsePrivateSystemHeaders ; diff --git a/src/system/libroot/posix/time/localtime.c b/src/system/libroot/posix/time/localtime.c index b0c724b2ed..aee2df89bf 100644 --- a/src/system/libroot/posix/time/localtime.c +++ b/src/system/libroot/posix/time/localtime.c @@ -226,6 +226,26 @@ int daylight = 0; time_t altzone = 0; #endif /* defined ALTZONE */ +#ifdef __HAIKU__ +# include + +static const char* +get_timezones_directory(void) +{ + static char path[PATH_MAX]; + if (path[0] != '\0') + return path; + + if (find_directory(B_SYSTEM_DATA_DIRECTORY, -1, false, path, sizeof(path)) + == B_OK) { + strlcat(path, "/timezones", sizeof(path)); + } else + strcpy(path, "/boot/system/data/timezones"); + + return path; +} +#endif + static long detzcode(codep) const char * const codep;