Boost logo

Boost Users :

From: Igor R (boost.lists_at_[hidden])
Date: 2008-07-23 12:11:15


// untested!!

namespace pt = boost::posix_time;
pt::ptime now1 = pt::microsec_clock::universal_time();
///....do something here...
pt::ptime now2 = pt::microsec_clock::universal_time();
pt::time_duration dur = now2 - now1;

you can get then dur.total_milliseconds();

> I've been struggling with how to use the Date_Time library to measure
> time elapsed (like to measure how long code takes to execute).
>
> Could somebody provide me with an example? Resolution should be around
> msec. I could not find any in the reference that particularly
> addresses this.
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net