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