Make FX_TIMEZONE XFA-only.

Move FX_TimeZoneOffsetInMinutes() as well.

Change-Id: Ia1429b85129b2df493ec6fd410c743c29b4ddfed
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/78871
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/cfx_datetime.cpp b/core/fxcrt/cfx_datetime.cpp
index b1cbcc7..fcf9eb0 100644
--- a/core/fxcrt/cfx_datetime.cpp
+++ b/core/fxcrt/cfx_datetime.cpp
@@ -97,10 +97,6 @@
   return ((iYear % 4) == 0 && (iYear % 100) != 0) || (iYear % 400) == 0;
 }
 
-int FX_TimeZoneOffsetInMinutes(const FX_TIMEZONE& tz) {
-  return tz.tzHour * 60 + tz.tzMinute;
-}
-
 // static
 CFX_DateTime CFX_DateTime::Now() {
   FXUT_SYSTEMTIME utLocal;
diff --git a/core/fxcrt/cfx_datetime.h b/core/fxcrt/cfx_datetime.h
index b482ee4..b49c153 100644
--- a/core/fxcrt/cfx_datetime.h
+++ b/core/fxcrt/cfx_datetime.h
@@ -9,14 +9,8 @@
 
 #include "core/fxcrt/fx_system.h"
 
-struct FX_TIMEZONE {
-  int8_t tzHour;
-  uint8_t tzMinute;
-};
-
 bool FX_IsLeapYear(int32_t iYear);
 uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth);
-int FX_TimeZoneOffsetInMinutes(const FX_TIMEZONE& tz);
 
 class CFX_DateTime {
  public:
diff --git a/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc b/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
index baba5da..481f286 100644
--- a/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
+++ b/testing/fuzzers/pdf_cfgas_stringformatter_fuzzer.cc
@@ -8,6 +8,7 @@
 
 #include <vector>
 
+#include "core/fxcrt/cfx_datetime.h"
 #include "core/fxcrt/fx_string.h"
 #include "public/fpdfview.h"
 #include "testing/fuzzers/pdfium_fuzzer_util.h"
diff --git a/xfa/fgas/crt/BUILD.gn b/xfa/fgas/crt/BUILD.gn
index 33f2630..80c4f6c 100644
--- a/xfa/fgas/crt/BUILD.gn
+++ b/xfa/fgas/crt/BUILD.gn
@@ -13,6 +13,8 @@
     "cfgas_decimal.h",
     "cfgas_stringformatter.cpp",
     "cfgas_stringformatter.h",
+    "fx_timezone.cpp",
+    "fx_timezone.h",
     "locale_iface.h",
     "locale_mgr_iface.h",
   ]
diff --git a/xfa/fgas/crt/cfgas_stringformatter.cpp b/xfa/fgas/crt/cfgas_stringformatter.cpp
index 8b7874a..ac2cbe9 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.cpp
+++ b/xfa/fgas/crt/cfgas_stringformatter.cpp
@@ -11,6 +11,7 @@
 #include <utility>
 #include <vector>
 
+#include "core/fxcrt/cfx_datetime.h"
 #include "core/fxcrt/fx_extension.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "third_party/base/notreached.h"
diff --git a/xfa/fgas/crt/cfgas_stringformatter.h b/xfa/fgas/crt/cfgas_stringformatter.h
index 4e67e52..3d0f7cd 100644
--- a/xfa/fgas/crt/cfgas_stringformatter.h
+++ b/xfa/fgas/crt/cfgas_stringformatter.h
@@ -13,6 +13,7 @@
 #include "third_party/base/span.h"
 #include "xfa/fgas/crt/locale_iface.h"
 
+class CFX_DateTime;
 class LocaleMgrIface;
 
 bool FX_DateFromCanonical(pdfium::span<const wchar_t> wsTime,
diff --git a/xfa/fgas/crt/fx_timezone.cpp b/xfa/fgas/crt/fx_timezone.cpp
new file mode 100644
index 0000000..f80a1d8
--- /dev/null
+++ b/xfa/fgas/crt/fx_timezone.cpp
@@ -0,0 +1,11 @@
+// Copyright 2021 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fgas/crt/fx_timezone.h"
+
+int FX_TimeZoneOffsetInMinutes(const FX_TIMEZONE& tz) {
+  return tz.tzHour * 60 + tz.tzMinute;
+}
diff --git a/xfa/fgas/crt/fx_timezone.h b/xfa/fgas/crt/fx_timezone.h
new file mode 100644
index 0000000..777df10
--- /dev/null
+++ b/xfa/fgas/crt/fx_timezone.h
@@ -0,0 +1,19 @@
+// Copyright 2021 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FGAS_CRT_FX_TIMEZONE_H_
+#define XFA_FGAS_CRT_FX_TIMEZONE_H_
+
+#include <stdint.h>
+
+struct FX_TIMEZONE {
+  int8_t tzHour;
+  uint8_t tzMinute;
+};
+
+int FX_TimeZoneOffsetInMinutes(const FX_TIMEZONE& tz);
+
+#endif  // XFA_FGAS_CRT_FX_TIMEZONE_H_
diff --git a/xfa/fgas/crt/locale_iface.h b/xfa/fgas/crt/locale_iface.h
index c8884a6..6976501 100644
--- a/xfa/fgas/crt/locale_iface.h
+++ b/xfa/fgas/crt/locale_iface.h
@@ -7,8 +7,8 @@
 #ifndef XFA_FGAS_CRT_LOCALE_IFACE_H_
 #define XFA_FGAS_CRT_LOCALE_IFACE_H_
 
-#include "core/fxcrt/cfx_datetime.h"
 #include "core/fxcrt/fx_string.h"
+#include "xfa/fgas/crt/fx_timezone.h"
 
 class LocaleIface {
  public:
diff --git a/xfa/fxfa/parser/cxfa_localevalue.cpp b/xfa/fxfa/parser/cxfa_localevalue.cpp
index 82c990c..708b152 100644
--- a/xfa/fxfa/parser/cxfa_localevalue.cpp
+++ b/xfa/fxfa/parser/cxfa_localevalue.cpp
@@ -11,6 +11,7 @@
 #include <utility>
 #include <vector>
 
+#include "core/fxcrt/cfx_datetime.h"
 #include "core/fxcrt/fx_extension.h"
 #include "third_party/base/check.h"
 #include "third_party/base/span.h"
diff --git a/xfa/fxfa/parser/cxfa_timezoneprovider.cpp b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
index 899e4e3..7ca90b5 100644
--- a/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
+++ b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
 
+#include <stdlib.h>
 #include <time.h>
 
 #include "build/build_config.h"
diff --git a/xfa/fxfa/parser/cxfa_timezoneprovider.h b/xfa/fxfa/parser/cxfa_timezoneprovider.h
index 753fbb7..3cfc8ad 100644
--- a/xfa/fxfa/parser/cxfa_timezoneprovider.h
+++ b/xfa/fxfa/parser/cxfa_timezoneprovider.h
@@ -7,7 +7,7 @@
 #ifndef XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_
 #define XFA_FXFA_PARSER_CXFA_TIMEZONEPROVIDER_H_
 
-#include "core/fxcrt/cfx_datetime.h"
+#include "xfa/fgas/crt/fx_timezone.h"
 
 class CXFA_TimeZoneProvider {
  public: