blob: 00267cf7aba0b0756248123a7d21a7e2e7c6fc2d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
--- third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.cpp.orig 2021-07-15 19:15:51 UTC
+++ third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
@@ -6,12 +6,16 @@
#include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+#include <stdint.h>
#include <stdlib.h>
#include <time.h>
#include "build/build_config.h"
static bool g_bProviderTimeZoneSet = false;
+#if defined(OS_BSD)
+static long g_lTimeZoneOffset = 0;
+#endif
#if defined(OS_WIN)
#define TIMEZONE _timezone
@@ -24,9 +28,21 @@ static bool g_bProviderTimeZoneSet = false;
CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() {
if (!g_bProviderTimeZoneSet) {
g_bProviderTimeZoneSet = true;
+#if defined(OS_BSD)
+ time_t now = time(nullptr);
+ struct tm tm = {};
+
+ localtime_r(&now, &tm);
+ g_lTimeZoneOffset = tm.tm_gmtoff;
+#else
TZSET();
+#endif
}
+#if defined(OS_BSD)
+ tz_minutes_ = static_cast<int8_t>((abs(g_lTimeZoneOffset) % 3600) / 60);
+#else
tz_minutes_ = TIMEZONE / -60;
+#endif
}
CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() = default;
|