Bug 1117064 - Use localtime_s in ComputeLocalTime on Windows. r=till
authorJacek Caban <jacek@codeweavers.com>
Sat, 03 Jan 2015 15:54:22 +0100
changeset 221935 5dba1e33ab69724d2eb973c578f9b520dc78f759
parent 221934 6c4b30ffe4d400adb94b16453c838ede151bc49b
child 221936 da6a98c3a8d16ea1a13d930e989e09322e5c92d5
push id28050
push userphilringnalda@gmail.com
push dateSun, 04 Jan 2015 04:02:52 +0000
treeherdermozilla-central@55f3224d7513 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1117064
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1117064 - Use localtime_s in ComputeLocalTime on Windows. r=till
js/src/vm/DateTime.cpp
--- a/js/src/vm/DateTime.cpp
+++ b/js/src/vm/DateTime.cpp
@@ -10,17 +10,19 @@
 
 #include "jsutil.h"
 
 using mozilla::UnspecifiedNaN;
 
 static bool
 ComputeLocalTime(time_t local, struct tm *ptm)
 {
-#ifdef HAVE_LOCALTIME_R
+#if defined(_WIN32)
+    return localtime_s(ptm, &local) == 0;
+#elif defined(HAVE_LOCALTIME_R)
     return localtime_r(&local, ptm);
 #else
     struct tm *otm = localtime(&local);
     if (!otm)
         return false;
     *ptm = *otm;
     return true;
 #endif