2023-11-25 13:24:01 +03:00
|
|
|
#include <time.h>
|
|
|
|
|
2023-11-30 17:52:46 +03:00
|
|
|
static long long int getMS()
|
2023-11-25 13:24:01 +03:00
|
|
|
{
|
|
|
|
struct timespec ts;
|
|
|
|
timespec_get(&ts, TIME_UTC);
|
|
|
|
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
|
|
|
}
|
|
|
|
|
|
|
|
void sleepMS(int msec)
|
|
|
|
{
|
|
|
|
long long int end = getMS() + msec;
|
|
|
|
while (getMS() < end);
|
|
|
|
}
|