22 #ifndef LELY_COAPP_DETAIL_CHRONO_HPP_ 23 #define LELY_COAPP_DETAIL_CHRONO_HPP_ 37 inline ::std::chrono::milliseconds
39 using namespace ::std::chrono;
40 return timeout <= 0 ? milliseconds::max() : milliseconds(timeout);
44 template <
class Rep,
class Period>
46 ToTimeout(const ::std::chrono::duration<Rep, Period>& d) {
47 using namespace ::std::chrono;
49 if (d == duration<Rep, Period>::max())
return 0;
50 auto timeout = duration_cast<milliseconds>(d).count();
52 if (timeout < 1)
return 1;
53 if (timeout > ::std::numeric_limits<int>::max())
54 return ::std::numeric_limits<int>::max();
64 #endif // LELY_COAPP_DETAIL_CHRONO_HPP_ This is the public header file of the C++ CANopen application library.
inline ::std::chrono::milliseconds FromTimeout(int timeout)
Converts an SDO timeout to a duration.
int ToTimeout(const ::std::chrono::duration< Rep, Period > &d)
Converts a duration to an SDO timeout.
Global namespace for the Lely Industries N.V. libraries.