| 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 "../../../core/include/fxcrt/fx_basic.h" | 7 #include "../../../core/include/fxcrt/fx_basic.h" |
| 8 #include "../../../core/include/fxcrt/fx_ext.h" | 8 #include "../../../core/include/fxcrt/fx_ext.h" |
| 9 #include "../../include/jsapi/fxjs_v8.h" | 9 #include "../../include/jsapi/fxjs_v8.h" |
| 10 #include "../../include/fsdk_define.h" | 10 #include "../../include/fsdk_define.h" |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 | 751 |
| 752 //JavaScript time implement begin. | 752 //JavaScript time implement begin. |
| 753 | 753 |
| 754 double _getLocalTZA() | 754 double _getLocalTZA() |
| 755 { | 755 { |
| 756 if(!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) | 756 if(!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) |
| 757 return 0; | 757 return 0; |
| 758 time_t t = 0; | 758 time_t t = 0; |
| 759 time(&t); | 759 time(&t); |
| 760 localtime(&t); | 760 localtime(&t); |
| 761 #if _MSC_VER >= 1900 |
| 762 // In gcc and in Visual Studio prior to VS 2015 'timezone' is a global |
| 763 // variable declared in time.h. That variable was deprecated and in VS 2015 |
| 764 // is removed, with _get_timezone replacing it. |
| 765 long timezone = 0; |
| 766 _get_timezone(&timezone); |
| 767 #endif |
| 761 return (double)(-(timezone * 1000)); | 768 return (double)(-(timezone * 1000)); |
| 762 } | 769 } |
| 763 | 770 |
| 764 int _getDaylightSavingTA(double d) | 771 int _getDaylightSavingTA(double d) |
| 765 { | 772 { |
| 766 if(!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) | 773 if(!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) |
| 767 return 0; | 774 return 0; |
| 768 time_t t = (time_t)(d/1000); | 775 time_t t = (time_t)(d/1000); |
| 769 struct tm * tmp = localtime(&t); | 776 struct tm * tmp = localtime(&t); |
| 770 if (tmp == NULL) | 777 if (tmp == NULL) |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 { | 1041 { |
| 1035 return d != d; | 1042 return d != d; |
| 1036 } | 1043 } |
| 1037 | 1044 |
| 1038 double JS_LocalTime(double d) | 1045 double JS_LocalTime(double d) |
| 1039 { | 1046 { |
| 1040 return JS_GetDateTime() + _getDaylightSavingTA(d); | 1047 return JS_GetDateTime() + _getDaylightSavingTA(d); |
| 1041 } | 1048 } |
| 1042 | 1049 |
| 1043 //JavaScript time implement End. | 1050 //JavaScript time implement End. |
| OLD | NEW |