Use c++ sleep_for rather than usleep.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
a2e7191604
commit
5536050b71
1 changed files with 3 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "StdAfx.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include <ncurses.h>
|
||||
|
||||
|
@ -208,7 +209,8 @@ namespace
|
|||
{
|
||||
if (us < nExecutionPeriodUsec)
|
||||
{
|
||||
usleep(nExecutionPeriodUsec - us);
|
||||
const auto duration = std::chrono::microseconds(nExecutionPeriodUsec - us);
|
||||
std::this_thread::sleep_for(duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue