|
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();
sleep(1);
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
documentation.
BR, Dmitry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk