Skip to content

Commit 27f936a

Browse files
<thread>: Avoid overflow in _To_absolute_time() (#5237)
1 parent 0190042 commit 27f936a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stl/inc/thread

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ _NODISCARD auto _To_absolute_time(const chrono::duration<_Rep, _Period>& _Rel_ti
169169
const auto _Now = chrono::steady_clock::now();
170170
decltype(_Now + _Rel_time) _Abs_time = _Now; // return common type
171171
if (_Rel_time > _Zero) {
172-
constexpr auto _Forever = (chrono::steady_clock::time_point::max)();
172+
constexpr auto _Forever = (decltype(_Abs_time)::max)();
173173
if (_Abs_time < _Forever - _Rel_time) {
174174
_Abs_time += _Rel_time;
175175
} else {

0 commit comments

Comments
 (0)