Documentation Home >> Headers >> <chrono> Header >> std::chrono::monotonic_clock class
[Note] Note

The std::chrono::monotonic_clock class is provided for backwards compatibility only; new programs should use the std::chrono::steady_clock class or std::chrono::high_resolution_clock class instead.

The std::chrono::monotonic_clock class provides access to the system-wide monotonic clock. The current time can be obtained by calling std::chrono::monotonic_clock::now(). There is no fixed relationship between values returned by std::chrono::monotonic_clock::now() and wall-clock time. A monotonic clock cannot go backwards, so if one call to std::chrono::monotonic_clock::now() happens-before another call to std::chrono::monotonic_clock::now(), the second call must return a time-point equal to or later than the first. The

class monotonic_clock
{
public:
    typedef unspecified-integral-type rep;
    typedef std::ratio<
        unspecified,unspecified> period;
    typedef std::chrono::duration<rep,period> duration;
    typedef std::chrono::time_point<monotonic_clock>
        time_point;
    static const bool is_monotonic=true;
    static const bool is_steady=true;

    static time_point now() noexcept;
};
Header

#include <chrono>

See Also