I found an interesting gotcha with std::numeric_limits
returning 0. The answer is to use seconds::max()
or std::numeric_lim
std::chrono::seconds
itself is not a standard arithmetic type, thus std::numeric_limits
is not specialized for it. So you just see some rather useless defaults.
To query the range of the underlying type used to count the ticks (which, under gcc, is the 64 bit long int
), use
std::numeric_limits::max();
instead.