Merge pull request #6219

72ca7e3b Fix time comparison math (Jason Rhinelander)
This commit is contained in:
Alexander Blair 2020-02-28 19:43:43 -08:00
commit afff9e7041
No known key found for this signature in database
GPG Key ID: C64552D877C32479

View File

@ -1671,9 +1671,9 @@ skip:
const float max_multiplier = 10.f; const float max_multiplier = 10.f;
const float min_multiplier = 1.25f; const float min_multiplier = 1.25f;
float multiplier = max_multiplier; float multiplier = max_multiplier;
if (dt/1e6 >= REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY) if (dt >= REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY)
{ {
multiplier = max_multiplier - (dt/1e6-REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY) * (max_multiplier - min_multiplier) / (REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD - REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY); multiplier = max_multiplier - (dt-REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY) * (max_multiplier - min_multiplier) / (REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD - REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY);
multiplier = std::min(max_multiplier, std::max(min_multiplier, multiplier)); multiplier = std::min(max_multiplier, std::max(min_multiplier, multiplier));
} }
if (dl_speed * .8f > ctx.m_current_speed_down * multiplier) if (dl_speed * .8f > ctx.m_current_speed_down * multiplier)