Merged revisions 51256 via svnmerge from
[asterisk/asterisk.git] / main / stdtime / localtime.c
index effb987..e54f2af 100644 (file)
@@ -61,6 +61,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/lock.h"
 #include "asterisk/localtime.h"
+#include "asterisk/strings.h"
 
 #ifndef lint
 #ifndef NOID
@@ -1055,7 +1056,7 @@ const char * const        zone;
 #ifdef _THREAD_SAFE
        ast_mutex_lock(&lcl_mutex);
 #endif
-       ast_tzset(zone);
+       ast_tzset(ast_strlen_zero(zone) ? "/etc/localtime" : zone);
        localsub(timep, 0L, p_tm, zone);
 #ifdef _THREAD_SAFE
        ast_mutex_unlock(&lcl_mutex);
@@ -1495,8 +1496,8 @@ const char * const        zone;
 #ifdef _THREAD_SAFE
        ast_mutex_lock(&lcl_mutex);
 #endif
-       ast_tzset(zone);
-       mktime_return_value = time1(tmp, localsub, 0L, zone);
+       ast_tzset(!ast_strlen_zero(zone) ? zone : "/etc/localtime");
+       mktime_return_value = time1(tmp, localsub, 0L, !ast_strlen_zero(zone) ? zone : "/etc/localtime");
 #ifdef _THREAD_SAFE
        ast_mutex_unlock(&lcl_mutex);
 #endif