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

Unified Diff: ppapi/shared_impl/time_conversion.cc

Issue 11567013: Fix PPAPI time conversion code to handle epoch times. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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 | « ppapi/ppapi_tests.gypi ('k') | ppapi/shared_impl/time_conversion_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/time_conversion.cc
diff --git a/ppapi/shared_impl/time_conversion.cc b/ppapi/shared_impl/time_conversion.cc
index 53d7b99de03b02726c4a28a8c7e2b5de82ff14fd..07ca6f73a2c5269661bf6be5f6acae13dd3ee5ea 100644
--- a/ppapi/shared_impl/time_conversion.cc
+++ b/ppapi/shared_impl/time_conversion.cc
@@ -30,6 +30,12 @@ PP_Time TimeToPPTime(base::Time t) {
}
base::Time PPTimeToTime(PP_Time t) {
+ // The time code handles exact "0" values as special, and produces
+ // a "null" Time object. But calling code would expect t==0 to represent the
+ // epoch (according to the description of PP_Time). Hence we just return the
+ // epoch in this case.
+ if (t == 0.0)
+ return base::Time::UnixEpoch();
return base::Time::FromDoubleT(t);
}
« no previous file with comments | « ppapi/ppapi_tests.gypi ('k') | ppapi/shared_impl/time_conversion_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698