0

Turn time_mac.cc back on, with workaround for scoped_cftyperef reset bug

Review URL: http://codereview.chromium.org/9342

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4641 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
amanda@chromium.org
2008-11-04 20:36:11 +00:00
parent c6959f8257
commit 1b5753a678
2 changed files with 8 additions and 10 deletions
base

@ -147,7 +147,7 @@
A5A0270B0E4A630D00498DA9 /* file_util_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5A0270A0E4A630D00498DA9 /* file_util_mac.mm */; };
A5CB82980E5C74E300FD6825 /* platform_test_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5CB82970E5C74E300FD6825 /* platform_test_mac.mm */; };
A5CE1D2B0E55F4D800AD0606 /* file_util_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = A5A0282D0E4CFA8500498DA9 /* file_util_unittest.cc */; };
AB14B6070EBFA74C00FB3807 /* time_posix.cc in Sources */ = {isa = PBXBuildFile; fileRef = AB14B6060EBFA74C00FB3807 /* time_posix.cc */; };
AB4C147D0EC0E3F600655FED /* time_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BEB81490D9B0F33009BA8DD /* time_mac.cc */; };
AB956DFD0E5DDB5D00BBE9D8 /* platform_canvas_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 829E2F990DBFD76300819EBF /* platform_canvas_mac.cc */; };
AB956DFE0E5DDB6000BBE9D8 /* platform_device_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 829E2F9D0DBFD76F00819EBF /* platform_device_mac.cc */; };
AB956DFF0E5DDB6900BBE9D8 /* bitmap_platform_device_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = 829E2F940DBFD74B00819EBF /* bitmap_platform_device_mac.cc */; };
@ -1388,6 +1388,7 @@
7BF882910E719389000BAF8A /* non_thread_safe.cc in Sources */,
ABF4B9B50DC2BC9F00A6E319 /* path_service.cc in Sources */,
824654A60DC25CD7007C2BAA /* pickle.cc in Sources */,
A573F5D90EBB78260055A84A /* platform_file_posix.cc in Sources */,
7BF164F30E660CA500AA999E /* platform_thread_mac.mm in Sources */,
93E703170E5D63E00046259B /* platform_thread_posix.cc in Sources */,
7BD8F4A10E65AA4600034DE9 /* process_util_posix.cc in Sources */,
@ -1415,6 +1416,7 @@
829E36730DC0FBAD00819EBF /* thread_local_storage_posix.cc in Sources */,
824654910DC25A8C007C2BAA /* time.cc in Sources */,
82D094550E5B892600FEC05C /* time_format.cc in Sources */,
AB4C147D0EC0E3F600655FED /* time_mac.cc in Sources */,
E49357220E422A36008F8B09 /* timer.cc in Sources */,
7BF882800E71929B000BAF8A /* trace_event.cc in Sources */,
820EB5020E3A618B009668FC /* tracked.cc in Sources */,
@ -1423,8 +1425,6 @@
9301C03B0E54C839001EF103 /* waitable_event_generic.cc in Sources */,
824655DD0DC659B8007C2BAA /* word_iterator.cc in Sources */,
7BF1658D0E663B4800AA999E /* worker_pool_mac.mm in Sources */,
A573F5D90EBB78260055A84A /* platform_file_posix.cc in Sources */,
AB14B6070EBFA74C00FB3807 /* time_posix.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

@ -28,7 +28,7 @@ namespace base {
// from 1970-01-01 00:00:00 UTC. Core Foundation uses a double second count
// since 2001-01-01 00:00:00 UTC.
// Some functions in time.c use time_t directly, so we provide a zero offset
// Some functions in time.cc use time_t directly, so we provide a zero offset
// for them. The epoch is 1970-01-01 00:00:00 UTC.
// static
const int64 Time::kTimeTToMicrosecondsOffset = GG_INT64_C(0);
@ -51,9 +51,8 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) {
date.month = exploded.month;
date.year = exploded.year;
scoped_cftyperef<CFTimeZoneRef> time_zone;
if (is_local)
time_zone.reset(CFTimeZoneCopySystem());
scoped_cftyperef<CFTimeZoneRef>
time_zone(is_local ? CFTimeZoneCopySystem() : NULL);
CFAbsoluteTime seconds = CFGregorianDateGetAbsoluteTime(date, time_zone) +
kCFAbsoluteTimeIntervalSince1970;
return Time(static_cast<int64>(seconds * kMicrosecondsPerSecond));
@ -64,9 +63,8 @@ void Time::Explode(bool is_local, Exploded* exploded) const {
(static_cast<double>(us_) / kMicrosecondsPerSecond) -
kCFAbsoluteTimeIntervalSince1970;
scoped_cftyperef<CFTimeZoneRef> time_zone;
if (is_local)
time_zone.reset(CFTimeZoneCopySystem());
scoped_cftyperef<CFTimeZoneRef>
time_zone(is_local ? CFTimeZoneCopySystem() : NULL);
CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(seconds, time_zone);
exploded->year = date.year;