]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
If a timezone is not specified, assume localtime (instead of gmtime) (Issue #7748)
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 18 Jan 2007 21:11:34 +0000 (21:11 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 18 Jan 2007 21:11:34 +0000 (21:11 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@51255 65c4cc65-6c06-0410-ace0-fbb531ad65f3

stdtime/localtime.c

index db125d9e6991716cc5b986f5660c67364a35e88c..e620d27be9c60e1ff9baa195cc926d495e3c09fb 100644 (file)
@@ -56,6 +56,7 @@
 #include "tzfile.h"
 #include "asterisk/lock.h"
 #include "asterisk/localtime.h"
+#include "asterisk/strings.h"
 
 
 #ifndef lint
@@ -1051,7 +1052,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