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 coordinated universal time (UTC), | 5 // Time represents an absolute point in coordinated universal time (UTC), |
6 // internally represented as microseconds (s/1,000,000) since the Windows epoch | 6 // internally represented as microseconds (s/1,000,000) since the Windows epoch |
7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are | 7 // (1601-01-01 00:00:00 UTC). System-dependent clock interface routines are |
8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump | 8 // defined in time_PLATFORM.cc. Note that values for Time may skew and jump |
9 // around as the operating system makes adjustments to synchronize (e.g., with | 9 // around as the operating system makes adjustments to synchronize (e.g., with |
10 // NTP servers). Thus, client code that uses the Time class must account for | 10 // NTP servers). Thus, client code that uses the Time class must account for |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // times are increasing, or that two calls to Now() won't be the same. | 450 // times are increasing, or that two calls to Now() won't be the same. |
451 static Time Now(); | 451 static Time Now(); |
452 | 452 |
453 // Returns the current time. Same as Now() except that this function always | 453 // Returns the current time. Same as Now() except that this function always |
454 // uses system time so that there are no discrepancies between the returned | 454 // uses system time so that there are no discrepancies between the returned |
455 // time and system time even on virtual environments including our test bot. | 455 // time and system time even on virtual environments including our test bot. |
456 // For timing sensitive unittests, this function should be used. | 456 // For timing sensitive unittests, this function should be used. |
457 static Time NowFromSystemTime(); | 457 static Time NowFromSystemTime(); |
458 | 458 |
459 // Converts to/from time_t in UTC and a Time class. | 459 // Converts to/from time_t in UTC and a Time class. |
460 // TODO(brettw) this should be removed once everybody starts using the |Time| | |
461 // class. | |
462 static Time FromTimeT(time_t tt); | 460 static Time FromTimeT(time_t tt); |
463 time_t ToTimeT() const; | 461 time_t ToTimeT() const; |
464 | 462 |
465 // Converts time to/from a double which is the number of seconds since epoch | 463 // Converts time to/from a double which is the number of seconds since epoch |
466 // (Jan 1, 1970). Webkit uses this format to represent time. | 464 // (Jan 1, 1970). Webkit uses this format to represent time. |
467 // Because WebKit initializes double time value to 0 to indicate "not | 465 // Because WebKit initializes double time value to 0 to indicate "not |
468 // initialized", we map it to empty Time object that also means "not | 466 // initialized", we map it to empty Time object that also means "not |
469 // initialized". | 467 // initialized". |
470 static Time FromDoubleT(double dt); | 468 static Time FromDoubleT(double dt); |
471 double ToDoubleT() const; | 469 double ToDoubleT() const; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 static void WaitUntilInitializedWin(); | 833 static void WaitUntilInitializedWin(); |
836 #endif | 834 #endif |
837 }; | 835 }; |
838 | 836 |
839 // For logging use only. | 837 // For logging use only. |
840 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 838 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
841 | 839 |
842 } // namespace base | 840 } // namespace base |
843 | 841 |
844 #endif // BASE_TIME_TIME_H_ | 842 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |