| Index: trunk/src/base/time/time.h
|
| ===================================================================
|
| --- trunk/src/base/time/time.h (revision 253642)
|
| +++ trunk/src/base/time/time.h (working copy)
|
| @@ -61,9 +61,9 @@
|
| }
|
|
|
| // Converts units of time to TimeDeltas.
|
| - static TimeDelta FromDays(int days);
|
| - static TimeDelta FromHours(int hours);
|
| - static TimeDelta FromMinutes(int minutes);
|
| + static TimeDelta FromDays(int64 days);
|
| + static TimeDelta FromHours(int64 hours);
|
| + static TimeDelta FromMinutes(int64 minutes);
|
| static TimeDelta FromSeconds(int64 secs);
|
| static TimeDelta FromMilliseconds(int64 ms);
|
| static TimeDelta FromMicroseconds(int64 us);
|
| @@ -79,11 +79,6 @@
|
| return TimeDelta(delta);
|
| }
|
|
|
| - // Returns the maximum time delta, which should be greater than any reasonable
|
| - // time delta we might compare it to. Adding or subtracting the maximum time
|
| - // delta to a time or another time delta has an undefined result.
|
| - static TimeDelta Max();
|
| -
|
| // Returns the internal numeric value of the TimeDelta object. Please don't
|
| // use this and do arithmetic on it, as it is more error prone than using the
|
| // provided operators.
|
| @@ -92,11 +87,6 @@
|
| return delta_;
|
| }
|
|
|
| - // Returns true if the time delta is the maximum time delta.
|
| - bool is_max() const {
|
| - return delta_ == std::numeric_limits<int64>::max();
|
| - }
|
| -
|
| #if defined(OS_POSIX)
|
| struct timespec ToTimeSpec() const;
|
| #endif
|
| @@ -503,50 +493,32 @@
|
| // Inline the TimeDelta factory methods, for fast TimeDelta construction.
|
|
|
| // static
|
| -inline TimeDelta TimeDelta::FromDays(int days) {
|
| - // Preserve max to prevent overflow.
|
| - if (days == std::numeric_limits<int>::max())
|
| - return Max();
|
| +inline TimeDelta TimeDelta::FromDays(int64 days) {
|
| return TimeDelta(days * Time::kMicrosecondsPerDay);
|
| }
|
|
|
| // static
|
| -inline TimeDelta TimeDelta::FromHours(int hours) {
|
| - // Preserve max to prevent overflow.
|
| - if (hours == std::numeric_limits<int>::max())
|
| - return Max();
|
| +inline TimeDelta TimeDelta::FromHours(int64 hours) {
|
| return TimeDelta(hours * Time::kMicrosecondsPerHour);
|
| }
|
|
|
| // static
|
| -inline TimeDelta TimeDelta::FromMinutes(int minutes) {
|
| - // Preserve max to prevent overflow.
|
| - if (minutes == std::numeric_limits<int>::max())
|
| - return Max();
|
| +inline TimeDelta TimeDelta::FromMinutes(int64 minutes) {
|
| return TimeDelta(minutes * Time::kMicrosecondsPerMinute);
|
| }
|
|
|
| // static
|
| inline TimeDelta TimeDelta::FromSeconds(int64 secs) {
|
| - // Preserve max to prevent overflow.
|
| - if (secs == std::numeric_limits<int64>::max())
|
| - return Max();
|
| return TimeDelta(secs * Time::kMicrosecondsPerSecond);
|
| }
|
|
|
| // static
|
| inline TimeDelta TimeDelta::FromMilliseconds(int64 ms) {
|
| - // Preserve max to prevent overflow.
|
| - if (ms == std::numeric_limits<int64>::max())
|
| - return Max();
|
| return TimeDelta(ms * Time::kMicrosecondsPerMillisecond);
|
| }
|
|
|
| // static
|
| inline TimeDelta TimeDelta::FromMicroseconds(int64 us) {
|
| - // Preserve max to prevent overflow.
|
| - if (us == std::numeric_limits<int64>::max())
|
| - return Max();
|
| return TimeDelta(us);
|
| }
|
|
|
|
|