Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* oln/utils/timer.hh (timer::restart): Fix method to allow a
running timer to be restarted.
(timer::resume): Fix documentation.
* tests/utils/tests/timer (check): Add a test case to check the
behavior of restart() on a running timer.
Index: olena/oln/utils/timer.hh
--- olena/oln/utils/timer.hh Sat, 13 Mar 2004 21:28:08 +0100 van-vl_n (oln/8_timer.hh 1.9
640)
+++ olena/oln/utils/timer.hh Mon, 16 Aug 2004 17:46:12 +0200 levill_r (oln/8_timer.hh 1.9
640)
@@ -73,13 +73,14 @@
{
assertion(status_ != e_unknown);
float val = total_time();
+ status_ = e_stopped;
start();
return val;
}
/*! Resume the timer.
**
- ** \pre The timer should be running.
+ ** \pre The timer should be stopped.
*/
void
resume()
Index: olena/tests/utils/tests/timer
--- olena/tests/utils/tests/timer Tue, 20 Apr 2004 15:16:21 +0200 van-vl_n
(oln/u/29_timer.cc 1.5 600)
+++ olena/tests/utils/tests/timer Mon, 16 Aug 2004 19:28:37 +0200 levill_r
(oln/u/29_timer.cc 1.5 600)
@@ -68,5 +68,17 @@
if (b >= 0)
OK_OR_FAIL;
+ b = t.total_time ();
+
+ t.restart ();
+
+ for (int i = 0; i < 1000000000; )
+ ++i;
+
+ b = t.total_time() - b;
+
+ if (b >= 0)
+ OK_OR_FAIL;
+
return fail;
}
Show replies by date