D17528: Refactor SlaveInterface::calcSpeed

Chinmoy Ranjan Pradhan noreply at phabricator.kde.org
Thu Jan 10 15:40:08 GMT 2019


chinmoyr added inline comments.

INLINE COMMENTS

> davidedmundson wrote in slaveinterface.cpp:106
> That wasn't there in the old code because it has this guard:
> 
> const qint64 diff = currentTime - d->start_time;
> 
> (effectively calculating elapsed)
> 
> Then
> 
> if (diff - d->last_time >= 900) {
> 
> So we known first-last is non-zero
> 
> Should the new code be
> 
> https://phabricator.kde.org/P287 ?
> 
> It seemed to work for me.

Indeed that should be the code here.
The old code checked the elapsed time since last "calcSpeed()" call whereas the new code checks the elapsed time since the timer started.

> broulik wrote in slaveinterface.cpp:113
> We likely get a division by zero here for some reason

I doubt it will be zero here. `elapsed_time` stores elapsed time since the timer started so it will continue to grow (?) and the difference will always be > 0.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D17528

To: chinmoyr, dfaure
Cc: davidedmundson, broulik, bruns, kde-frameworks-devel, michaelh, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190110/5da25c32/attachment.html>


More information about the Kde-frameworks-devel mailing list