Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Unified Diff: base/time_mac.cc

Issue 10916089: Fixing Time::Max()'s behavior with Time::ToTimeT() and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows. :( Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/time_mac.cc
diff --git a/base/time_mac.cc b/base/time_mac.cc
index 98641bb98b8ee6a9ba3b0ce0379bcf7edd1ac5d3..ca10bc88662cc1c470bf34e68bca0634899f5e5c 100644
--- a/base/time_mac.cc
+++ b/base/time_mac.cc
@@ -54,6 +54,8 @@ Time Time::Now() {
Time Time::FromCFAbsoluteTime(CFAbsoluteTime t) {
if (t == 0)
return Time(); // Consider 0 as a null Time.
+ if (t == std::numeric_limits<CFAbsoluteTime>::max())
+ return Max();
return Time(static_cast<int64>(
(t + kCFAbsoluteTimeIntervalSince1970) * kMicrosecondsPerSecond) +
kWindowsEpochDeltaMicroseconds);
@@ -62,6 +64,8 @@ Time Time::FromCFAbsoluteTime(CFAbsoluteTime t) {
CFAbsoluteTime Time::ToCFAbsoluteTime() const {
if (is_null())
return 0; // Consider 0 as a null Time.
+ if (is_max())
+ return std::numeric_limits<CFAbsoluteTime>::max();
return (static_cast<CFAbsoluteTime>(us_ - kWindowsEpochDeltaMicroseconds) /
kMicrosecondsPerSecond) - kCFAbsoluteTimeIntervalSince1970;
}

Powered by Google App Engine
This is Rietveld 408576698