Chromium Code Reviews| 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 // VS 2015 | |
| 762 long timezone = 0; | |
| 763 _get_timezone(&timezone); | |
| 764 #endif | |
| 761 return (double)(-(timezone * 1000)); | 765 return (double)(-(timezone * 1000)); |
|
Tom Sepez
2015/04/08 22:51:19
Is _get_timezone() defined on all of the VS versio
| |
| 762 } | 766 } |
| 763 | 767 |
| 764 int _getDaylightSavingTA(double d) | 768 int _getDaylightSavingTA(double d) |
| 765 { | 769 { |
| 766 if(!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) | 770 if(!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) |
| 767 return 0; | 771 return 0; |
| 768 time_t t = (time_t)(d/1000); | 772 time_t t = (time_t)(d/1000); |
| 769 struct tm * tmp = localtime(&t); | 773 struct tm * tmp = localtime(&t); |
| 770 if (tmp == NULL) | 774 if (tmp == NULL) |
| 771 return 0; | 775 return 0; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1034 { | 1038 { |
| 1035 return d != d; | 1039 return d != d; |
| 1036 } | 1040 } |
| 1037 | 1041 |
| 1038 double JS_LocalTime(double d) | 1042 double JS_LocalTime(double d) |
| 1039 { | 1043 { |
| 1040 return JS_GetDateTime() + _getDaylightSavingTA(d); | 1044 return JS_GetDateTime() + _getDaylightSavingTA(d); |
| 1041 } | 1045 } |
| 1042 | 1046 |
| 1043 //JavaScript time implement End. | 1047 //JavaScript time implement End. |
| OLD | NEW |