Title: [206496] trunk
Revision
206496
Author
commit-qu...@webkit.org
Date
2016-09-27 21:52:52 -0700 (Tue, 27 Sep 2016)

Log Message

[CMake] Add HAVE_LOCALTIME_R definition
https://bugs.webkit.org/show_bug.cgi?id=162636

Patch by Don Olmstead <don.olmst...@am.sony.com> on 2016-09-27
Reviewed by Alex Christensen.

.:

* Source/cmake/OptionsCommon.cmake:

Source/WTF:

* wtf/DateMath.cpp:
(WTF::getLocalTime):
* wtf/GregorianDateTime.cpp:
(WTF::GregorianDateTime::setToCurrentLocalTime):
* wtf/Platform.h:

Modified Paths

Diff

Modified: trunk/ChangeLog (206495 => 206496)


--- trunk/ChangeLog	2016-09-28 04:35:27 UTC (rev 206495)
+++ trunk/ChangeLog	2016-09-28 04:52:52 UTC (rev 206496)
@@ -1,5 +1,14 @@
 2016-09-27  Don Olmstead  <don.olmst...@am.sony.com>
 
+        [CMake] Add HAVE_LOCALTIME_R definition
+        https://bugs.webkit.org/show_bug.cgi?id=162636
+
+        Reviewed by Alex Christensen.
+
+        * Source/cmake/OptionsCommon.cmake:
+
+2016-09-27  Don Olmstead  <don.olmst...@am.sony.com>
+
         [CMake] Use CMake to determine HAVE_* defines
         https://bugs.webkit.org/show_bug.cgi?id=162368
 

Modified: trunk/Source/WTF/ChangeLog (206495 => 206496)


--- trunk/Source/WTF/ChangeLog	2016-09-28 04:35:27 UTC (rev 206495)
+++ trunk/Source/WTF/ChangeLog	2016-09-28 04:52:52 UTC (rev 206496)
@@ -1,3 +1,16 @@
+2016-09-27  Don Olmstead  <don.olmst...@am.sony.com>
+
+        [CMake] Add HAVE_LOCALTIME_R definition
+        https://bugs.webkit.org/show_bug.cgi?id=162636
+
+        Reviewed by Alex Christensen.
+
+        * wtf/DateMath.cpp:
+        (WTF::getLocalTime):
+        * wtf/GregorianDateTime.cpp:
+        (WTF::GregorianDateTime::setToCurrentLocalTime):
+        * wtf/Platform.h:
+
 2016-09-27  JF Bastien  <jfbast...@apple.com>
 
         Speed up Heap::isMarkedConcurrently

Modified: trunk/Source/WTF/wtf/DateMath.cpp (206495 => 206496)


--- trunk/Source/WTF/wtf/DateMath.cpp	2016-09-28 04:35:27 UTC (rev 206495)
+++ trunk/Source/WTF/wtf/DateMath.cpp	2016-09-28 04:52:52 UTC (rev 206496)
@@ -123,12 +123,12 @@
 
 static inline void getLocalTime(const time_t* localTime, struct tm* localTM)
 {
-#if COMPILER(MINGW)
-    *localTM = *localtime(localTime);
-#elif COMPILER(MSVC)
+#if COMPILER(MSVC)
     localtime_s(localTM, localTime);
+#elif HAVE(LOCALTIME_R)
+    localtime_r(localTime, localTM);
 #else
-    localtime_r(localTime, localTM);
+    localtime_s(localTime, localTM);
 #endif
 }
 

Modified: trunk/Source/WTF/wtf/GregorianDateTime.cpp (206495 => 206496)


--- trunk/Source/WTF/wtf/GregorianDateTime.cpp	2016-09-28 04:35:27 UTC (rev 206495)
+++ trunk/Source/WTF/wtf/GregorianDateTime.cpp	2016-09-28 04:52:52 UTC (rev 206496)
@@ -67,7 +67,11 @@
 #else
     tm localTM;
     time_t localTime = time(0);
+#if HAVE(LOCALTIME_R)
     localtime_r(&localTime, &localTM);
+#else
+    localtime_s(&localTime, &localTM);
+#endif
 
     m_year = localTM.tm_year + 1900;
     m_month = localTM.tm_mon;

Modified: trunk/Source/WTF/wtf/Platform.h (206495 => 206496)


--- trunk/Source/WTF/wtf/Platform.h	2016-09-28 04:35:27 UTC (rev 206495)
+++ trunk/Source/WTF/wtf/Platform.h	2016-09-28 04:52:52 UTC (rev 206496)
@@ -609,6 +609,7 @@
 #if OS(DARWIN)
 #define HAVE_ERRNO_H 1
 #define HAVE_LANGINFO_H 1
+#define HAVE_LOCALTIME_R 1
 #define HAVE_MMAP 1
 #define HAVE_SIGNAL_H 1
 #define HAVE_STAT_BIRTHTIME 1

Modified: trunk/Source/cmake/OptionsCommon.cmake (206495 => 206496)


--- trunk/Source/cmake/OptionsCommon.cmake	2016-09-28 04:35:27 UTC (rev 206495)
+++ trunk/Source/cmake/OptionsCommon.cmake	2016-09-28 04:52:52 UTC (rev 206496)
@@ -246,6 +246,7 @@
 # Check for functions
 _HAVE_CHECK_FUNCTION(HAVE_ALIGNED_MALLOC _aligned_malloc)
 _HAVE_CHECK_FUNCTION(HAVE_ISDEBUGGERPRESENT IsDebuggerPresent)
+_HAVE_CHECK_FUNCTION(HAVE_LOCALTIME_R localtime_r)
 _HAVE_CHECK_FUNCTION(HAVE_STRNSTR strnstr)
 _HAVE_CHECK_FUNCTION(HAVE_TIMEGM timegm)
 _HAVE_CHECK_FUNCTION(HAVE_VASPRINTF vasprintf)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to