summaryrefslogtreecommitdiff
path: root/fxjs/js_define.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-08-10 19:03:47 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-10 19:03:47 +0000
commitf36a4644b828bd9ad214a42511af91b4a1073eea (patch)
tree05231ac87adbac430efcb2b53a97c5886df15047 /fxjs/js_define.cpp
parent70cca3663a0ea6c290b55c290ba5eb1f1c9db572 (diff)
downloadpdfium-f36a4644b828bd9ad214a42511af91b4a1073eea.tar.xz
Remove direct calls to timechromium/3519
Replaces them with calles to the proxy function, FXSYS_time, so that tests may use a stable time value instead of the wall clock value. BUG=pdfium:1104 Change-Id: I4743c4634f56d4a6cba1f1130c4562a35cee1887 Reviewed-on: https://pdfium-review.googlesource.com/39853 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fxjs/js_define.cpp')
-rw-r--r--fxjs/js_define.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/fxjs/js_define.cpp b/fxjs/js_define.cpp
index 124fd91651..0a18b6d15b 100644
--- a/fxjs/js_define.cpp
+++ b/fxjs/js_define.cpp
@@ -13,6 +13,7 @@
#include <limits>
#include <vector>
+#include "core/fxcrt/fx_extension.h"
#include "fxjs/cjs_document.h"
#include "fxjs/cjs_object.h"
@@ -22,7 +23,7 @@ double GetLocalTZA() {
if (!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
return 0;
time_t t = 0;
- time(&t);
+ FXSYS_time(&t);
localtime(&t);
#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
// In gcc 'timezone' is a global variable declared in time.h. In VC++, that
@@ -174,7 +175,7 @@ void JSDestructor(v8::Local<v8::Object> obj) {
double JS_GetDateTime() {
if (!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
return 0;
- time_t t = time(nullptr);
+ time_t t = FXSYS_time(nullptr);
struct tm* pTm = localtime(&t);
int year = pTm->tm_year + 1900;