summaryrefslogtreecommitdiffstats
path: root/base/time.h
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-27 18:44:03 +0000
committermkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-27 18:44:03 +0000
commitc462cafe30bcb6156ae04ecace86f6810539d18a (patch)
tree713bc7358957740825a420b4f3746ee4b9d6e58b /base/time.h
parentfd9ba17a49852c34493ba87838e9b68c9606146e (diff)
downloadchromium_src-c462cafe30bcb6156ae04ecace86f6810539d18a.zip
chromium_src-c462cafe30bcb6156ae04ecace86f6810539d18a.tar.gz
chromium_src-c462cafe30bcb6156ae04ecace86f6810539d18a.tar.bz2
Add 'base::Time::Max()' to explicitly refer to the end of time.
BrowingDataRemover (and, I imagine, other systems) recognized ranges bounded by null Time objects ('base::Time()') as referring to "everything". That introduces easily-forgotten complexity, which leads to avoidable mistakes in logic. This CL provides a mechanism for avoiding this sort of confusion in the future by adding the ability to explicitly refer to the end of time via 'base::Time::Max()'. It simply returns a Time object whose internal counter is set to the maximum int64, which means that simple comparisons like 'time <= end' will do The Right Thing™. BUG=144972 Review URL: https://chromiumcodereview.appspot.com/10883061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153514 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/time.h')
-rw-r--r--base/time.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/base/time.h b/base/time.h
index 389887a..4d9bf35 100644
--- a/base/time.h
+++ b/base/time.h
@@ -254,6 +254,10 @@ class BASE_EXPORT Time {
// times are increasing, or that two calls to Now() won't be the same.
static Time Now();
+ // Returns the maximum time, which should be greater than any reasonable time
+ // with which we might compare it.
+ static Time Max();
+
// Returns the current time. Same as Now() except that this function always
// uses system time so that there are no discrepancies between the returned
// time and system time even on virtual environments including our test bot.