Commit edac4968 authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

Migrate to use the new public getOffsetFromLocal method

This API is the new public one added in ICU 69.1
in https://github.com/unicode-org/icu/pull/1610

Bug: v8:11512
Change-Id: I424e15e6a60edee7c98e6ce55974986f0bb6ab1b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2876368
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74428}
parent 5b619efd
......@@ -2027,23 +2027,15 @@ icu::TimeZone* ICUTimezoneCache::GetTimeZone() {
bool ICUTimezoneCache::GetOffsets(double time_ms, bool is_utc,
int32_t* raw_offset, int32_t* dst_offset) {
UErrorCode status = U_ZERO_ERROR;
// TODO(jshin): ICU TimeZone class handles skipped time differently from
// Ecma 262 (https://github.com/tc39/ecma262/pull/778) and icu::TimeZone
// class does not expose the necessary API. Fixing
// http://bugs.icu-project.org/trac/ticket/13268 would make it easy to
// implement the proposed spec change. A proposed fix for ICU is
// https://chromium-review.googlesource.com/851265 .
// In the meantime, use an internal (still public) API of icu::BasicTimeZone.
// Once it's accepted by the upstream, get rid of cast. Note that casting
// TimeZone to BasicTimeZone is safe because we know that icu::TimeZone used
// here is a BasicTimeZone.
if (is_utc) {
GetTimeZone()->getOffset(time_ms, false, *raw_offset, *dst_offset, status);
} else {
// Note that casting TimeZone to BasicTimeZone is safe because we know that
// icu::TimeZone used here is a BasicTimeZone.
static_cast<const icu::BasicTimeZone*>(GetTimeZone())
->getOffsetFromLocal(time_ms, icu::BasicTimeZone::kFormer,
icu::BasicTimeZone::kFormer, *raw_offset,
*dst_offset, status);
->getOffsetFromLocal(time_ms, UCAL_TZ_LOCAL_FORMER,
UCAL_TZ_LOCAL_FORMER, *raw_offset, *dst_offset,
status);
}
return U_SUCCESS(status);
......
......@@ -21,7 +21,7 @@
#include "unicode/locid.h"
#include "unicode/uversion.h"
#define V8_MINIMUM_ICU_VERSION 68
#define V8_MINIMUM_ICU_VERSION 69
namespace U_ICU_NAMESPACE {
class BreakIterator;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment