1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00
falk-werner_webfuse-provider/test/webfuse/utils/msleep.cc

19 lines
410 B
C++
Raw Normal View History

2020-02-20 16:15:13 +00:00
#include "webfuse/utils/msleep.hpp"
2019-02-13 19:49:05 +00:00
#include <ctime>
2019-03-26 22:04:53 +00:00
namespace webfuse_test
2019-02-13 19:49:05 +00:00
{
void msleep(long millis)
{
long const secs_per_msec = 1000;
long const msecs_per_nsec = (1000 * 1000);
long const seconds = millis / secs_per_msec;
long const nanos = (millis % secs_per_msec) * msecs_per_nsec;
2019-02-13 19:49:05 +00:00
struct timespec timeout = { seconds, nanos };
while (0 != nanosleep(&timeout, &timeout));
}
}