Skip to content

Commit 702dd54

Browse files
gjasnydeanberris
authored andcommitted
Make compatible with boost::chrono
In Visual Studio 2013 the std::chrono implementation is quite buggy. Therefore we fall back to boost::chrono by specifying -DBOOST_ASIO_DISABLE_STD_CHRONO. This change makes cppnetlib compatible with that flag.
1 parent a5252b9 commit 702dd54

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

boost/network/protocol/http/client/connection/async_normal.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ struct http_async_connection
179179

180180
auto self = this->shared_from_this();
181181
if (timeout_ > 0) {
182+
#if defined(BOOST_ASIO_HAS_STD_CHRONO)
182183
timer_.expires_from_now(std::chrono::seconds(timeout_));
184+
#elif defined(BOOST_ASIO_HAS_BOOST_CHRONO)
185+
timer_.expires_from_now(boost::chrono::seconds(timeout_));
186+
#else
187+
#error Need a chrono implementation
188+
#endif
183189
timer_.async_wait(request_strand_.wrap([=] (boost::system::error_code const &ec) {
184190
self->handle_timeout(ec);
185191
}));

0 commit comments

Comments
 (0)