38 template <
class InputIterator>
43 std::chrono::system_clock::time_point,
44 typename std::iterator_traits<InputIterator>::value_type>::value,
45 "Iterator dereference to wrong type");
46 auto tp = std::chrono::system_clock::time_point::max();
55 if (tp == std::chrono::system_clock::time_point::max())
58 int timeout = std::chrono::duration_cast<std::chrono::milliseconds>(
59 tp - std::chrono::system_clock::now())
61 DEBUG(
"Next timeout: " << timeout);
62 return timeout < 0 ? 0 : timeout;