Index: chromeos/settings/timezone_settings.cc |
diff --git a/chromeos/settings/timezone_settings.cc b/chromeos/settings/timezone_settings.cc |
index 99539ae0a75235ebdf6ea56b4e3b3128317c2006..4d0b0b4db2f6eb886e465b82d270b578a55ead5e 100644 |
--- a/chromeos/settings/timezone_settings.cc |
+++ b/chromeos/settings/timezone_settings.cc |
@@ -20,6 +20,7 @@ |
#include "base/sys_info.h" |
#include "base/task_runner.h" |
#include "base/threading/worker_pool.h" |
+#include "chromeos/settings/timezone_settings_helper.h" |
namespace { |
@@ -166,6 +167,7 @@ static const char* kTimeZones[] = { |
"Asia/Singapore", |
"Asia/Manila", |
"Asia/Taipei", |
+ "Asia/Ulaanbaatar", |
"Asia/Makassar", |
"Asia/Irkutsk", |
"Asia/Yakutsk", |
@@ -275,7 +277,7 @@ class TimezoneSettingsBaseImpl : public chromeos::system::TimezoneSettings { |
// Otherwise, returns a timezone from |timezones_|, if such exists, that has |
// the same rule as the given |timezone|. |
// Otherwise, returns NULL. |
- // Note multiple timezones with the same time zone offset may exist |
+ // Note multiple timezones with the same time zone rules may exist |
// e.g. |
// US/Pacific == America/Los_Angeles |
const icu::TimeZone* GetKnownTimezoneOrNull( |
@@ -362,18 +364,7 @@ TimezoneSettingsBaseImpl::TimezoneSettingsBaseImpl() { |
const icu::TimeZone* TimezoneSettingsBaseImpl::GetKnownTimezoneOrNull( |
const icu::TimeZone& timezone) const { |
- const icu::TimeZone* known_timezone = NULL; |
- for (std::vector<icu::TimeZone*>::const_iterator iter = timezones_.begin(); |
- iter != timezones_.end(); ++iter) { |
- const icu::TimeZone* entry = *iter; |
- if (*entry == timezone) |
- return entry; |
- if (entry->hasSameRules(timezone)) |
- known_timezone = entry; |
- } |
- |
- // May return NULL if we did not find a matching timezone in our list. |
- return known_timezone; |
+ return chromeos::system::GetKnownTimezoneOrNull(timezone, timezones_); |
} |
void TimezoneSettingsImpl::SetTimezone(const icu::TimeZone& timezone) { |
@@ -419,6 +410,11 @@ TimezoneSettingsImpl::TimezoneSettingsImpl() { |
icu::TimeZone::setDefault(*timezone_); |
VLOG(1) << "Timezone initially set to " << id; |
+ icu::UnicodeString resolvedId; |
+ std::string resolvedIdStr; |
+ timezone_->getID(resolvedId); |
+ VLOG(1) << "Timezone initially resolved to " |
+ << resolvedId.toUTF8String(resolvedIdStr); |
} |
void TimezoneSettingsStubImpl::SetTimezone(const icu::TimeZone& timezone) { |
@@ -428,6 +424,8 @@ void TimezoneSettingsStubImpl::SetTimezone(const icu::TimeZone& timezone) { |
if (!known_timezone) |
known_timezone = &timezone; |
+ std::string id = base::UTF16ToUTF8(GetTimezoneID(*known_timezone)); |
+ VLOG(1) << "Setting timezone to " << id; |
timezone_.reset(known_timezone->clone()); |
icu::TimeZone::setDefault(*known_timezone); |
FOR_EACH_OBSERVER(Observer, observers_, TimezoneChanged(*known_timezone)); |