← Back to team overview

linuxdcpp-team team mailing list archive

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

 

Fixed the calls to the minute timer (the previous one got called 59
times xD) this time we use instead the samethod as with the second timer
to get the information.

Again this timer is still lossy, if you prefer a non lossy one (i,e, if
suddendly 5 seconds pass it will mark the 5 seconds  replace inside the
while: nextSecond = now + seconds(1); into nextSecond += seconds(1); and
nextMin = now + seconds(60); into nextMin += seconds(60);

** Patch removed: "Lossy timer implementation. Copyright assigned to Jacek Sieka."
   https://bugs.launchpad.net/dcplusplus/+bug/713742/+attachment/3542625/+files/use_lossy_timer.patch

** Patch added: "Lossy timer implementation. Copyright assigned to Jacek Sieka."
   https://bugs.launchpad.net/dcplusplus/+bug/713742/+attachment/3544157/+files/use_lossy_timer.patch

-- 
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