• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
8 
9 #include <time.h>
10 
11 static bool g_bProviderTimeZoneSet = false;
12 
CXFA_TimeZoneProvider()13 CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() {
14 #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
15   if (!g_bProviderTimeZoneSet) {
16     g_bProviderTimeZoneSet = true;
17     _tzset();
18   }
19   m_tz.tzHour = static_cast<int8_t>(_timezone / 3600 * -1);
20   m_tz.tzMinute = static_cast<int8_t>((abs(_timezone) % 3600) / 60);
21 #else
22   if (!g_bProviderTimeZoneSet) {
23     g_bProviderTimeZoneSet = true;
24     tzset();
25   }
26   m_tz.tzHour = static_cast<int8_t>(timezone / 3600 * -1);
27   m_tz.tzMinute =
28       static_cast<int8_t>((abs(static_cast<int>(timezone)) % 3600) / 60);
29 #endif
30 }
31 
~CXFA_TimeZoneProvider()32 CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() {}
33