diff options
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cfxjse_formcalc_context.cpp | 2 | ||||
-rw-r--r-- | fxjs/js_define.cpp | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp index f95ee831a7..d77453ef72 100644 --- a/fxjs/cfxjse_formcalc_context.cpp +++ b/fxjs/cfxjse_formcalc_context.cpp @@ -959,7 +959,7 @@ void GetLocalTimeZone(int32_t* pHour, int32_t* pMin, int32_t* pSec) { FXSYS_time(&now); struct tm* pGmt = gmtime(&now); - struct tm* pLocal = localtime(&now); + struct tm* pLocal = FXSYS_localtime(&now); *pHour = pLocal->tm_hour - pGmt->tm_hour; *pMin = pLocal->tm_min - pGmt->tm_min; *pSec = pLocal->tm_sec - pGmt->tm_sec; diff --git a/fxjs/js_define.cpp b/fxjs/js_define.cpp index 54bd8e1c3a..b4e0197b54 100644 --- a/fxjs/js_define.cpp +++ b/fxjs/js_define.cpp @@ -24,7 +24,7 @@ double GetLocalTZA() { return 0; time_t t = 0; FXSYS_time(&t); - localtime(&t); + FXSYS_localtime(&t); #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ // In gcc 'timezone' is a global variable declared in time.h. In VC++, that // variable was removed in VC++ 2015, with _get_timezone replacing it. @@ -38,7 +38,7 @@ int GetDaylightSavingTA(double d) { if (!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) return 0; time_t t = (time_t)(d / 1000); - struct tm* tmp = localtime(&t); + struct tm* tmp = FXSYS_localtime(&t); if (!tmp) return 0; if (tmp->tm_isdst > 0) @@ -175,12 +175,10 @@ void JSDestructor(v8::Local<v8::Object> obj) { double JS_GetDateTime() { if (!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) return 0; - time_t t = FXSYS_time(nullptr); - struct tm* pTm = localtime(&t); - - int year = pTm->tm_year + 1900; - double t1 = TimeFromYear(year); + time_t t = FXSYS_time(nullptr); + struct tm* pTm = FXSYS_localtime(&t); + double t1 = TimeFromYear(pTm->tm_year + 1900); return t1 + pTm->tm_yday * 86400000.0 + pTm->tm_hour * 3600000.0 + pTm->tm_min * 60000.0 + pTm->tm_sec * 1000.0; } |