OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Time represents an absolute point in time, internally represented as | 5 // Time represents an absolute point in time, internally represented as |
6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each | 6 // microseconds (s/1,000,000) since a platform-dependent epoch. Each |
7 // platform's epoch, along with other system-dependent clock interface | 7 // platform's epoch, along with other system-dependent clock interface |
8 // routines, is defined in time_PLATFORM.cc. | 8 // routines, is defined in time_PLATFORM.cc. |
9 // | 9 // |
10 // TimeDelta represents a duration of time, internally represented in | 10 // TimeDelta represents a duration of time, internally represented in |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } | 247 } |
248 | 248 |
249 // Returns the time for epoch in Unix-like system (Jan 1, 1970). | 249 // Returns the time for epoch in Unix-like system (Jan 1, 1970). |
250 static Time UnixEpoch(); | 250 static Time UnixEpoch(); |
251 | 251 |
252 // Returns the current time. Watch out, the system might adjust its clock | 252 // Returns the current time. Watch out, the system might adjust its clock |
253 // in which case time will actually go backwards. We don't guarantee that | 253 // in which case time will actually go backwards. We don't guarantee that |
254 // times are increasing, or that two calls to Now() won't be the same. | 254 // times are increasing, or that two calls to Now() won't be the same. |
255 static Time Now(); | 255 static Time Now(); |
256 | 256 |
| 257 // Returns the maximum time, which should be greater than any reasonable time |
| 258 // with which we might compare it. |
| 259 static Time Max(); |
| 260 |
257 // Returns the current time. Same as Now() except that this function always | 261 // Returns the current time. Same as Now() except that this function always |
258 // uses system time so that there are no discrepancies between the returned | 262 // uses system time so that there are no discrepancies between the returned |
259 // time and system time even on virtual environments including our test bot. | 263 // time and system time even on virtual environments including our test bot. |
260 // For timing sensitive unittests, this function should be used. | 264 // For timing sensitive unittests, this function should be used. |
261 static Time NowFromSystemTime(); | 265 static Time NowFromSystemTime(); |
262 | 266 |
263 // Converts to/from time_t in UTC and a Time class. | 267 // Converts to/from time_t in UTC and a Time class. |
264 // TODO(brettw) this should be removed once everybody starts using the |Time| | 268 // TODO(brettw) this should be removed once everybody starts using the |Time| |
265 // class. | 269 // class. |
266 static Time FromTimeT(time_t tt); | 270 static Time FromTimeT(time_t tt); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 #endif | 608 #endif |
605 }; | 609 }; |
606 | 610 |
607 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 611 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
608 return TimeTicks(t.ticks_ + delta_); | 612 return TimeTicks(t.ticks_ + delta_); |
609 } | 613 } |
610 | 614 |
611 } // namespace base | 615 } // namespace base |
612 | 616 |
613 #endif // BASE_TIME_H_ | 617 #endif // BASE_TIME_H_ |
OLD | NEW |