
Hi, I've been having a problem recently with boost::timer. I have the following code: #include <iostream> #include <boost/timer.hpp> int main() { boost::timer t; // (here: some initialization stuff) t.restart(); // (here: a job that takes several seconts) std::cout << "Total time: " << t.elapsed() << "s." << std::endl; } While on my windows machine it displays the correct time, when I compile it on Ubuntu, it constantly displays zero seconds, regardless how long the job really takes. Do you have any ideas why that might be happening? I'm using boost 1.40 and Ubuntu 9.04. Thanx in advance! -- View this message in context: http://old.nabble.com/boost%3A%3Atimer-elapsed-time-tp27846807p27846807.html Sent from the Boost - Users mailing list archive at Nabble.com.

2010/3/10 zbierak <zbierak@gmail.com>
While on my windows machine it displays the correct time, when I compile it on Ubuntu, it constantly displays zero seconds, regardless how long the job really takes. Do you have any ideas why that might be happening? I'm using boost 1.40 and Ubuntu 9.04. Thanx in advance!
boost::timer uses function clock to measure time. On linux clock returns CPU time, while on windows it returns wall time. You program probably does not consume CPU, that's why you get zero results on linux. Roman Perepelitsa.
participants (2)
-
Roman Perepelitsa
-
zbierak