Use c++ sleep_for rather than usleep.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2020-06-30 14:02:31 +01:00
parent a2e7191604
commit 5536050b71

View file

@ -1,6 +1,7 @@
#include "StdAfx.h" #include "StdAfx.h"
#include <chrono> #include <chrono>
#include <thread>
#include <iostream> #include <iostream>
#include <ncurses.h> #include <ncurses.h>
@ -208,7 +209,8 @@ namespace
{ {
if (us < nExecutionPeriodUsec) if (us < nExecutionPeriodUsec)
{ {
usleep(nExecutionPeriodUsec - us); const auto duration = std::chrono::microseconds(nExecutionPeriodUsec - us);
std::this_thread::sleep_for(duration);
} }
} }
} }