← Back to team overview

linuxdcpp-team team mailing list archive

[Bug 713742] Re: TimerManager generate double tick per second on some situations

 

Good day! TimerManager was recently appended, and now looks like this:
# Normalize minute events. Earlier minute was equal to 60 cycles, and
between minute intervals to stretch unpredictably than 60 real
seconds. Now the minute events are generated on time, and do not depend on
Seconds of events.
# Added an hourly event.
# Added does not disable debug message displayed for an extended
previous cycle if it is longer than the second.
The complete code is available to the manager here:
https://code.google.com/p/flylinkdc/source/browse/trunk/client/TimerManager.h?spec=svn13018&r=13018
https://code.google.com/p/flylinkdc/source/browse/trunk/client/TimerManager.cpp?spec=svn13018&r=13018

-- 
You received this bug notification because you are a member of
Dcplusplus-team, which is subscribed to DC++.
https://bugs.launchpad.net/bugs/713742

Title:
  TimerManager generate  double tick per second on some situations

Status in DC++:
  Confirmed

Bug description:
  Code to fix this error quote below:

  int TimerManager::run()
  {
  	int nextMin = 0;
  	
  	ptime now = microsec_clock::universal_time();
  	ptime nextSecond = now + seconds(1);
  	while (!mtx.timed_lock(nextSecond))
  	{
  		const uint64_t t = getTick();
  		now = microsec_clock::universal_time();
  		nextSecond += seconds(1);
  		if (nextSecond < now)
  		{
  			nextSecond = now + seconds(1); // [!] IRainman fix TimerManager error: two tick generated in one second.
  		}
  		
  		fire(TimerManagerListener::Second(), t);
  		if (nextMin++ >= 60)
  		{
  			fire(TimerManagerListener::Minute(), t);
  			nextMin = 0;
  		}
  	}
  	
  	dcdebug("TimerManager done\n");
  	return 0;
  }

  autor FlylinkDC++ Team http://code.google.com/p/flylinkdc

To manage notifications about this bug go to:
https://bugs.launchpad.net/dcplusplus/+bug/713742/+subscriptions


References