You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
393 B

#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));
}
}