Boost logo

Boost Users :

Subject: [Boost-users] boost timer with sleep
From: Andre Paim Lemos (andrepaim_at_[hidden])
Date: 2008-11-10 09:42:04


The following code:

#include <iostream>
#include <boost/timer.hpp>
#include <unistd.h>

int main()
{

  boost::timer t;

  sleep(1);
  std::cout << t.elapsed() << std::endl;
  t.restart();
  sleep(3);
  std::cout << t.elapsed() << std::endl;

  return(0);
}

Returns (compiled with gcc 4.2.4 on Ubuntu Linux 8.04 using boost 1.36):

andre_at_andre-desktop:~/test$ ./timer_test
0
0

Is this result expected? Why?
There is another timer implementation that works with sleep?

[]'s
Andre Paim Lemos



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