Debian Codegraph @

debian/patches/system-ICU/TestingFunctions-Update-ICU-s-default-tz-when-setting-TZ.patch

raw
1 From: Iain Lane <[email protected]>
2 Date: Mon, 17 Feb 2020 12:40:13 +0000
3 Subject: TestingFunctions: Update ICU's default tz when setting $TZ
4
5 ICU maintains its own idea of the default timezone, which we need to
6 synchronise when we set TZ directly, as we do here.
7
8 Forwarded: no (but should be)
9 ---
10 js/src/builtin/TestingFunctions.cpp | 8 +++++++-
11 1 file changed, 7 insertions(+), 1 deletion(-)
12
13 diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp
14 index 006824e..d59386f 100644
15 --- a/js/src/builtin/TestingFunctions.cpp
16 +++ b/js/src/builtin/TestingFunctions.cpp
17 @@ -92,6 +92,7 @@
18 #include "js/Wrapper.h"
19 #include "threading/CpuCount.h"
20 #ifdef JS_HAS_INTL_API
21 +# include "unicode/timezone.h"
22 # include "unicode/ucal.h"
23 # include "unicode/uchar.h"
24 # include "unicode/uloc.h"
25 @@ -6563,7 +6564,12 @@ static bool SetTimeZone(JSContext* cx, unsigned argc, Value* vp) {
26 # if defined(_WIN32)
27 return _putenv_s("TZ", value) == 0;
28 # else
29 - return setenv("TZ", value, true) == 0;
30 + int r;
31 + r = setenv("TZ", value, true) == 0;
32 + if (icu::TimeZone* defaultZone = icu::TimeZone::detectHostTimeZone()) {
33 + icu::TimeZone::adoptDefault(defaultZone);
34 + }
35 + return r;
36 # endif /* _WIN32 */
37 };
38