Overview
Features
Download
Documentation
Community
Add-Ons & Services

Bug in Stopwatch?

Please post support and help requests here.

Bug in Stopwatch?

Postby erik.sjodin » 03 Mar 2008, 16:30

Hi, I just noticed that if you call stop() multiple times in succession on a stopwatch you get erroneous elapsed times, and if you call start() multiple times it restarts the stopwatch each time. I think the expected behavior would be start() to start/unpause the stopwatch and stop() to stop/pause it.

I got the stopwatch to work as I expected it to do by checking if the stopwatch is running/stopped in the inlines... What do you think?

inline void Stopwatch::start()
{
if(!_running){
_start.update();
_running = true;
}
}


inline void Stopwatch::stop()
{
if(_running){
Timestamp current;
_elapsed += current - _start;
_running = false;
}
}


erik.sjodin
 
Posts: 2
Joined: 07 Feb 2008, 12:57
Location: Other

Re: Bug in Stopwatch?

Postby guenter » 17 Mar 2008, 16:17

I have created a request in the bug tracker for this issue.
guenter
 
Posts: 1110
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Bug in Stopwatch?

Postby erik.sjodin » 02 Apr 2008, 19:45

thanks!
erik.sjodin
 
Posts: 2
Joined: 07 Feb 2008, 12:57
Location: Other


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron