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 247761 5dba1e33ab69724d2eb973c578f9b520dc78f759
parent 247760 6c4b30ffe4d400adb94b16453c838ede151bc49b
child 247762 da6a98c3a8d16ea1a13d930e989e09322e5c92d5
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [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