Fix basic_stream expires_after (API Change):

API Changes:

basic_stream::expires_after used to take a nanosecond duration type argument. This
required users on systems where the steady_clock::duration_type was less accurate
to explicity duration_cast when calling this function, making code non-portable.
The duration type is now that of the embedded steady_clock.

Many thanks to @spdw for noticing this and providing a patch.

fixes #1943
closes #1960
This commit is contained in:
Richard Hodges
2020-05-21 14:48:51 +02:00
parent 73097d3bd3
commit d7f1426f34
3 changed files with 12 additions and 2 deletions

View File

@@ -1,5 +1,15 @@
* Fix basic_stream expires_after (API Change)
* Fix FILE namespace qualification * Fix FILE namespace qualification
API Changes:
basic_stream::expires_after used to take a nanosecond duration type argument. This
required users on systems where the steady_clock::duration_type was less accurate
to explicity duration_cast when calling this function, making code non-portable.
The duration type is now that of the embedded steady_clock.
--------------------------------------------------------------------------------
Version 294: Version 294:
* Fix FILE namespace qualification * Fix FILE namespace qualification

View File

@@ -456,7 +456,7 @@ public:
*/ */
void void
expires_after( expires_after(
std::chrono::nanoseconds expiry_time); net::steady_timer::duration expiry_time);
/** Set the timeout for the next logical operation. /** Set the timeout for the next logical operation.

View File

@@ -704,7 +704,7 @@ release_socket() ->
template<class Protocol, class Executor, class RatePolicy> template<class Protocol, class Executor, class RatePolicy>
void void
basic_stream<Protocol, Executor, RatePolicy>:: basic_stream<Protocol, Executor, RatePolicy>::
expires_after(std::chrono::nanoseconds expiry_time) expires_after(net::steady_timer::duration expiry_time)
{ {
// If assert goes off, it means that there are // If assert goes off, it means that there are
// already read or write (or connect) operations // already read or write (or connect) operations