Boost logo

Boost :

Subject: [boost] [date_time] monotonic_time() proposal
From: Dmitry Goncharov (dgoncharov_at_[hidden])
Date: 2010-02-26 04:16:35

This proposal suggests adding monotonic_time() static member function to
the boost::date_time::microsec_clock and second_clock classes.

usage example:

#include <unistd.h> // for sleep()
#include <iostream>
#include <boost/date_time/posix_time/posix_time.hpp>
#include "monotonic_time.hpp"

int main()
    namespace pt = boost::posix_time;

    typedef ext::microsec_clock<pt::ptime> usclock_t; // namespace ext
instead of boost::date_time
    pt::ptime now = usclock_t::monotonic_time();
    pt::ptime later = usclock_t::monotonic_time();
    std::cout << later - now << std::endl;

Prototype implementation can be found in the attachment.
If there is interest i am willing to finish the implementation and

BR, Dmitry

Boost list run by bdawes at, gregod at, cpdaniel at, john at