Chromium Code Reviews| Index: src/date.h |
| diff --git a/src/date.h b/src/date.h |
| index 0a3e91beb26589e1b5078e420bfe07a8b18ada25..9f081bb185593e02b5d9e543172f990b4f0d842b 100644 |
| --- a/src/date.h |
| +++ b/src/date.h |
| @@ -93,7 +93,12 @@ class DateCache { |
| if (time_ms < 0 || time_ms > kMaxEpochTimeInMs) { |
| time_ms = EquivalentTime(time_ms); |
| } |
| - return base::OS::LocalTimezone(static_cast<double>(time_ms), tz_cache_); |
| + bool is_dst = DaylightSavingsOffsetInMs(time_ms) != 0; |
| + const char** name = is_dst ? &dst_tz_name_ : &tz_name_; |
|
jgruber
2017/03/03 08:09:57
Nit: Can you use plain 'const char* name' instead
Dan Ehrenberg
2017/03/03 12:57:44
I don't think so, because then I don't see how I c
jgruber
2017/03/03 13:02:34
Ah, gotcha. sgtm.
|
| + if (*name == nullptr) { |
| + *name = base::OS::LocalTimezone(static_cast<double>(time_ms), tz_cache_); |
| + } |
| + return *name; |
| } |
| // ECMA 262 - 15.9.5.26 |
| @@ -277,6 +282,10 @@ class DateCache { |
| int ymd_month_; |
| int ymd_day_; |
| + // Timezone name cache |
| + const char* tz_name_; |
| + const char* dst_tz_name_; |
| + |
| base::TimezoneCache* tz_cache_; |
| }; |