| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "fpdfsdk/javascript/JS_Value.h" | 7 #include "fpdfsdk/javascript/JS_Value.h" |
| 8 | 8 |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 | 10 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 case 11: | 746 case 11: |
| 747 return day - 333 - leap; | 747 return day - 333 - leap; |
| 748 default: | 748 default: |
| 749 return 0; | 749 return 0; |
| 750 } | 750 } |
| 751 } | 751 } |
| 752 | 752 |
| 753 double JS_GetDateTime() { | 753 double JS_GetDateTime() { |
| 754 if (!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) | 754 if (!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) |
| 755 return 0; | 755 return 0; |
| 756 time_t t = time(NULL); | 756 time_t t = time(nullptr); |
| 757 struct tm* pTm = localtime(&t); | 757 struct tm* pTm = localtime(&t); |
| 758 | 758 |
| 759 int year = pTm->tm_year + 1900; | 759 int year = pTm->tm_year + 1900; |
| 760 double t1 = _TimeFromYear(year); | 760 double t1 = _TimeFromYear(year); |
| 761 | 761 |
| 762 return t1 + pTm->tm_yday * 86400000.0 + pTm->tm_hour * 3600000.0 + | 762 return t1 + pTm->tm_yday * 86400000.0 + pTm->tm_hour * 3600000.0 + |
| 763 pTm->tm_min * 60000.0 + pTm->tm_sec * 1000.0; | 763 pTm->tm_min * 60000.0 + pTm->tm_sec * 1000.0; |
| 764 } | 764 } |
| 765 | 765 |
| 766 int JS_GetYearFromTime(double dt) { | 766 int JS_GetYearFromTime(double dt) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 for (size_t i = 0; i < nKeywords; ++i) { | 893 for (size_t i = 0; i < nKeywords; ++i) { |
| 894 const wchar_t* property = va_arg(ap, const wchar_t*); | 894 const wchar_t* property = va_arg(ap, const wchar_t*); |
| 895 v8::Local<v8::Value> v8Value = | 895 v8::Local<v8::Value> v8Value = |
| 896 FXJS_GetObjectElement(pRuntime->GetIsolate(), pObj, property); | 896 FXJS_GetObjectElement(pRuntime->GetIsolate(), pObj, property); |
| 897 if (!v8Value->IsUndefined()) | 897 if (!v8Value->IsUndefined()) |
| 898 result[i] = CJS_Value(pRuntime, v8Value, CJS_Value::VT_unknown); | 898 result[i] = CJS_Value(pRuntime, v8Value, CJS_Value::VT_unknown); |
| 899 } | 899 } |
| 900 va_end(ap); | 900 va_end(ap); |
| 901 return result; | 901 return result; |
| 902 } | 902 } |
| OLD | NEW |