Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|
mmenke
2016/05/18 17:32:00
You shouldn't update copyright dates when updating
maksims (do not use this acc)
2016/05/19 09:57:20
Done.
| |
| 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 |
| 11 // this. | 11 // this. |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 int hour; // Hour within the current day (0-23) | 413 int hour; // Hour within the current day (0-23) |
| 414 int minute; // Minute within the current hour (0-59) | 414 int minute; // Minute within the current hour (0-59) |
| 415 int second; // Second within the current minute (0-59 plus leap | 415 int second; // Second within the current minute (0-59 plus leap |
| 416 // seconds which may take it up to 60). | 416 // seconds which may take it up to 60). |
| 417 int millisecond; // Milliseconds within the current second (0-999) | 417 int millisecond; // Milliseconds within the current second (0-999) |
| 418 | 418 |
| 419 // A cursory test for whether the data members are within their | 419 // A cursory test for whether the data members are within their |
| 420 // respective ranges. A 'true' return value does not guarantee the | 420 // respective ranges. A 'true' return value does not guarantee the |
| 421 // Exploded value can be successfully converted to a Time value. | 421 // Exploded value can be successfully converted to a Time value. |
| 422 bool HasValidValues() const; | 422 bool HasValidValues() const; |
| 423 bool operator!=(const Exploded& rhs); | |
|
eroman
2016/05/18 19:35:17
I don't think we want to call this operator!=().
Mark Mentovai
2016/05/18 20:07:15
I had the same comment as a draft, then I went to
maksims (do not use this acc)
2016/05/19 09:57:20
Ok!
| |
| 423 }; | 424 }; |
| 424 | 425 |
| 425 // Contains the NULL time. Use Time::Now() to get the current time. | 426 // Contains the NULL time. Use Time::Now() to get the current time. |
| 426 Time() : TimeBase(0) { | 427 Time() : TimeBase(0) { |
| 427 } | 428 } |
| 428 | 429 |
| 429 // Returns the time for epoch in Unix-like system (Jan 1, 1970). | 430 // Returns the time for epoch in Unix-like system (Jan 1, 1970). |
| 430 static Time UnixEpoch(); | 431 static Time UnixEpoch(); |
| 431 | 432 |
| 432 // Returns the current time. Watch out, the system might adjust its clock | 433 // Returns the current time. Watch out, the system might adjust its clock |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 // this function to deactivate the high resolution timer. | 508 // this function to deactivate the high resolution timer. |
| 508 static bool ActivateHighResolutionTimer(bool activate); | 509 static bool ActivateHighResolutionTimer(bool activate); |
| 509 | 510 |
| 510 // Returns true if the high resolution timer is both enabled and activated. | 511 // Returns true if the high resolution timer is both enabled and activated. |
| 511 // This is provided for testing only, and is not tracked in a thread-safe | 512 // This is provided for testing only, and is not tracked in a thread-safe |
| 512 // way. | 513 // way. |
| 513 static bool IsHighResolutionTimerInUse(); | 514 static bool IsHighResolutionTimerInUse(); |
| 514 #endif | 515 #endif |
| 515 | 516 |
| 516 // Converts an exploded structure representing either the local time or UTC | 517 // Converts an exploded structure representing either the local time or UTC |
| 517 // into a Time class. | 518 // into a Time class. |
|
eroman
2016/05/18 19:35:17
This documentation should also be updated to clari
maksims (do not use this acc)
2016/05/19 09:57:19
Well, can you please check the patch? Your proposa
| |
| 518 static Time FromUTCExploded(const Exploded& exploded) { | 519 static Time FromUTCExploded(const Exploded& exploded) { |
| 519 return FromExploded(false, exploded); | 520 return FromExploded(false, exploded); |
| 520 } | 521 } |
| 521 static Time FromLocalExploded(const Exploded& exploded) { | 522 static Time FromLocalExploded(const Exploded& exploded) { |
| 522 return FromExploded(true, exploded); | 523 return FromExploded(true, exploded); |
| 523 } | 524 } |
| 524 | 525 |
| 525 // Converts a string representation of time to a Time object. | 526 // Converts a string representation of time to a Time object. |
| 526 // An example of a time string which is converted is as below:- | 527 // An example of a time string which is converted is as below:- |
| 527 // "Tue, 15 Nov 1994 12:45:26 GMT". If the timezone is not specified | 528 // "Tue, 15 Nov 1994 12:45:26 GMT". If the timezone is not specified |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 776 static void WaitUntilInitializedWin(); | 777 static void WaitUntilInitializedWin(); |
| 777 #endif | 778 #endif |
| 778 }; | 779 }; |
| 779 | 780 |
| 780 // For logging use only. | 781 // For logging use only. |
| 781 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 782 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
| 782 | 783 |
| 783 } // namespace base | 784 } // namespace base |
| 784 | 785 |
| 785 #endif // BASE_TIME_TIME_H_ | 786 #endif // BASE_TIME_TIME_H_ |
| OLD | NEW |