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

Unified Diff: base/time/time.cc

Issue 2655233003: Revert of base::Time should correctly handle -epoch time values from Javascript (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | base/time/time_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/time/time.cc
diff --git a/base/time/time.cc b/base/time/time.cc
index 397ba15d227a710df19614f62e972b43cf0c9600..df3942cc858c5ecc7277a3a5db4e02cc0b946ccb 100644
--- a/base/time/time.cc
+++ b/base/time/time.cc
@@ -191,6 +191,10 @@
}
double Time::ToJsTime() const {
+ if (is_null()) {
+ // Preserve 0 so the invalid result doesn't depend on the platform.
+ return 0;
+ }
if (is_max()) {
// Preserve max without offset to prevent overflow.
return std::numeric_limits<double>::infinity();
« no previous file with comments | « no previous file | base/time/time_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698