summaryrefslogtreecommitdiffstats
path: root/base/time.h
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-08 17:50:07 +0000
committermkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-08 17:50:07 +0000
commita9e5f04481565af0a3c8dbe770b14899f24b68f7 (patch)
tree4565198c5cdff1435acd19f5efc903eb306ee061 /base/time.h
parent4a6d53c71fb914da3dd9e15cdc72b385b91701ec (diff)
downloadchromium_src-a9e5f04481565af0a3c8dbe770b14899f24b68f7.zip
chromium_src-a9e5f04481565af0a3c8dbe770b14899f24b68f7.tar.gz
chromium_src-a9e5f04481565af0a3c8dbe770b14899f24b68f7.tar.bz2
Fixing Time::Max()'s behavior with Time::ToTimeT() and friends.
It looks like the math that's done to convert epoch times between platforms is giving incorrect results when confronted with a "max" time. This CL adjusts the various conversion methods to persist maxness in the same way they currently persist zeroness. BUG=146328 Review URL: https://chromiumcodereview.appspot.com/10916089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155591 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time.h')
-rw-r--r--base/time.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/base/time.h b/base/time.h
index 4d9bf35..ceed500 100644
--- a/base/time.h
+++ b/base/time.h
@@ -45,6 +45,8 @@
#include <windows.h>
#endif
+#include <limits>
+
namespace base {
class Time;
@@ -246,6 +248,11 @@ class BASE_EXPORT Time {
return us_ == 0;
}
+ // Returns true if the time object is the maximum time.
+ bool is_max() const {
+ return us_ == std::numeric_limits<int64>::max();
+ }
+
// Returns the time for epoch in Unix-like system (Jan 1, 1970).
static Time UnixEpoch();