Replace C-style clock() with std::chrono::steady_clock to fix timing on Linux

This commit is contained in:
Adam Honse committed 2020-07-02 16:59:30 -05:00
1 parent 5aad79135f
commit ad4e198aea
4 files changed
+8 -7

No files matched your search

@@ -317,7 +317,7 @@ void RGBController_HyperXKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_HyperXKeyboard::DeviceUpdateLEDs()
{
last_update_time = clock();
last_update_time = std::chrono::steady_clock::now();
if(active_mode == 0)
{
@@ -363,7 +363,7 @@ void RGBController_HyperXKeyboard::KeepaliveThread()
{
if(active_mode == 0)
{
if((clock() - last_update_time) > 50)
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
{
UpdateLEDs();
}