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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 return value > std::numeric_limits<int64_t>::max() | 660 return value > std::numeric_limits<int64_t>::max() |
661 ? Max() | 661 ? Max() |
662 : value < -std::numeric_limits<int64_t>::max() | 662 : value < -std::numeric_limits<int64_t>::max() |
663 ? -Max() | 663 ? -Max() |
664 : TimeDelta(static_cast<int64_t>(value)); | 664 : TimeDelta(static_cast<int64_t>(value)); |
665 } | 665 } |
666 | 666 |
667 // static | 667 // static |
668 constexpr TimeDelta TimeDelta::FromProduct(int64_t value, | 668 constexpr TimeDelta TimeDelta::FromProduct(int64_t value, |
669 int64_t positive_value) { | 669 int64_t positive_value) { |
670 return (DCHECK(positive_value > 0), | 670 return ( |
671 #if !defined(_PREFAST_) || !defined(OS_WIN) | |
dcheng
2016/06/29 08:07:48
Are there non-Windows builds that define _PREFAST_
brucedawson
2016/06/29 17:47:18
I check OS_WIN for consistency with other places t
| |
672 // Avoid internal compiler errors in /analyze builds with VS 2015 | |
673 // update 3. | |
674 // https://connect.microsoft.com/VisualStudio/feedback/details/2870865 | |
675 DCHECK(positive_value > 0), | |
676 #endif | |
671 value > std::numeric_limits<int64_t>::max() / positive_value | 677 value > std::numeric_limits<int64_t>::max() / positive_value |
672 ? Max() | 678 ? Max() |
673 : value < -std::numeric_limits<int64_t>::max() / positive_value | 679 : value < -std::numeric_limits<int64_t>::max() / positive_value |
674 ? -Max() | 680 ? -Max() |
675 : TimeDelta(value * positive_value)); | 681 : TimeDelta(value * positive_value)); |
676 } | 682 } |
677 | 683 |
678 // For logging use only. | 684 // For logging use only. |
679 BASE_EXPORT std::ostream& operator<<(std::ostream& os, Time time); | 685 BASE_EXPORT std::ostream& operator<<(std::ostream& os, Time time); |
680 | 686 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 static void WaitUntilInitializedWin(); | 823 static void WaitUntilInitializedWin(); |
818 #endif | 824 #endif |
819 }; | 825 }; |
820 | 826 |
821 // For logging use only. | 827 // For logging use only. |
822 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); | 828 BASE_EXPORT std::ostream& operator<<(std::ostream& os, ThreadTicks time_ticks); |
823 | 829 |
824 } // namespace base | 830 } // namespace base |
825 | 831 |
826 #endif // BASE_TIME_TIME_H_ | 832 #endif // BASE_TIME_TIME_H_ |
OLD | NEW |