Behavior on Timer.reset()

6 views
Skip to first unread message

lpell...@gmail.com

unread,
Oct 1, 2009, 8:42:15 AM10/1/09
to robworkdevel
Hi
When calling reset on a rw::common::Timer the clock resets and it starts counting. I find the somewhat inconvenient and would prefer a behavior where it resets the counter and keep the current state of either counting or not counting. Otherwise one would have to use two instructions
timer.reset();
timer.pause();
to reset and stop the time. With this setup it is not possible to guarantee that the time has a value of 0. Especially if the thread is scheduled out after reset, then the timer contain a (relative) large value after pause.

If a solution with keeping the current state of the time is not acceptable (might break old code), then I will at the very least suggest introducing a resetAndPause() to enable user to reset a timer to zero.

- Lars-Peter


Jimmy Alison Jørgensen

unread,
Oct 4, 2009, 9:24:17 AM10/4/09
to robwor...@googlegroups.com

I would prefer changing the reset functionality though resetAndPause() is also acceptable for me.

Reply all
Reply to author
Forward
0 new messages