summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 22:57:27 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 22:57:27 +0000
commit62aa811ac11b10fb7e60159df3ea8b8dc422e4b9 (patch)
treeecab8c533b6a6726f00b5ef1780c645c4011703b /base
parent577661ca4ef3719ce0733fd2eb9998cc15364c13 (diff)
downloadchromium_src-62aa811ac11b10fb7e60159df3ea8b8dc422e4b9.zip
chromium_src-62aa811ac11b10fb7e60159df3ea8b8dc422e4b9.tar.gz
chromium_src-62aa811ac11b10fb7e60159df3ea8b8dc422e4b9.tar.bz2
Fix Time::FromDoubleT so that it will return null time when 0 is passed.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3175044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/time.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/base/time.cc b/base/time.cc
index 383f939..cebc693 100644
--- a/base/time.cc
+++ b/base/time.cc
@@ -66,6 +66,8 @@ time_t Time::ToTimeT() const {
// static
Time Time::FromDoubleT(double dt) {
+ if (dt == 0)
+ return Time(); // Preserve 0 so we can tell it doesn't exist.
return Time(static_cast<int64>((dt *
static_cast<double>(kMicrosecondsPerSecond)) +
kTimeTToMicrosecondsOffset));