std::chrono cleanup: always use steady_clock

This commit is contained in:
Nekotekina 2020-12-11 16:31:32 +03:00
parent 12a48fc6d1
commit aa3aef4beb
19 changed files with 96 additions and 97 deletions

View file

@ -492,7 +492,7 @@ void xinput_pad_handler::apply_pad_data(const std::shared_ptr<PadDevice>& device
dev->smallVibrate = speed_small;
// XBox One Controller can't handle faster vibration updates than ~10ms. Elite is even worse. So I'll use 20ms to be on the safe side. No lag was noticable.
if (dev->newVibrateData && (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - dev->last_vibration) > 20ms))
if (dev->newVibrateData && steady_clock::now() - dev->last_vibration > 20ms)
{
XINPUT_VIBRATION vibrate;
vibrate.wLeftMotorSpeed = speed_large * 257;
@ -501,7 +501,7 @@ void xinput_pad_handler::apply_pad_data(const std::shared_ptr<PadDevice>& device
if ((*xinputSetState)(padnum, &vibrate) == ERROR_SUCCESS)
{
dev->newVibrateData = false;
dev->last_vibration = std::chrono::high_resolution_clock::now();
dev->last_vibration = steady_clock::now();
}
}
}