| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // Returns true if the time object has not been initialized. | 200 // Returns true if the time object has not been initialized. |
| 201 bool is_null() const { | 201 bool is_null() const { |
| 202 return us_ == 0; | 202 return us_ == 0; |
| 203 } | 203 } |
| 204 | 204 |
| 205 // Returns the current time. Watch out, the system might adjust its clock | 205 // Returns the current time. Watch out, the system might adjust its clock |
| 206 // in which case time will actually go backwards. We don't guarantee that | 206 // in which case time will actually go backwards. We don't guarantee that |
| 207 // times are increasing, or that two calls to Now() won't be the same. | 207 // times are increasing, or that two calls to Now() won't be the same. |
| 208 static Time Now(); | 208 static Time Now(); |
| 209 | 209 |
| 210 // Returns the current time. Same as Now() except that this function always |
| 211 // uses system time so that there are no discrepancies between the returned |
| 212 // time and system time even on virtual environments including our test bot. |
| 213 // For timing sensitive unittests, this function should be used. |
| 214 static Time NowFromSystemTime(); |
| 215 |
| 210 // Converts to/from time_t in UTC and a Time class. | 216 // Converts to/from time_t in UTC and a Time class. |
| 211 // TODO(brettw) this should be removed once everybody starts using the |Time| | 217 // TODO(brettw) this should be removed once everybody starts using the |Time| |
| 212 // class. | 218 // class. |
| 213 static Time FromTimeT(time_t tt); | 219 static Time FromTimeT(time_t tt); |
| 214 time_t ToTimeT() const; | 220 time_t ToTimeT() const; |
| 215 | 221 |
| 216 // Converts time to/from a double which is the number of seconds since epoch | 222 // Converts time to/from a double which is the number of seconds since epoch |
| 217 // (Jan 1, 1970). Webkit uses this format to represent time. | 223 // (Jan 1, 1970). Webkit uses this format to represent time. |
| 218 static Time FromDoubleT(double dt); | 224 static Time FromDoubleT(double dt); |
| 219 double ToDoubleT() const; | 225 double ToDoubleT() const; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 #endif | 475 #endif |
| 470 }; | 476 }; |
| 471 | 477 |
| 472 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { | 478 inline TimeTicks TimeDelta::operator+(TimeTicks t) const { |
| 473 return TimeTicks(t.ticks_ + delta_); | 479 return TimeTicks(t.ticks_ + delta_); |
| 474 } | 480 } |
| 475 | 481 |
| 476 } // namespace base | 482 } // namespace base |
| 477 | 483 |
| 478 #endif // BASE_TIME_H_ | 484 #endif // BASE_TIME_H_ |
| OLD | NEW |