parent
7970cece50
commit
bb917ab5c5
@ -0,0 +1,19 @@
|
||||
#include "msleep.hpp"
|
||||
#include <ctime>
|
||||
|
||||
namespace wsfs_test
|
||||
{
|
||||
|
||||
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;
|
||||
|
||||
struct timespec timeout = { seconds, nanos };
|
||||
while (0 != nanosleep(&timeout, &timeout));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#ifndef _WSFS_TEST_MSLEEP_HPP
|
||||
#define _WSFS_TEST_MSLEEP_HPP
|
||||
|
||||
namespace wsfs_test
|
||||
{
|
||||
|
||||
extern void msleep(long millis);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in new issue