#include <windows.h> | |
#include <nt.h> | |
#include <errno.h> | |
int usleep(unsigned long int useconds) { | |
LARGE_INTEGER interval; | |
interval.QuadPart = -(unsigned long long int)useconds * 10; | |
long int status = NtDelayExecution(1, &interval); | |
return __set_errno_from_ntstatus(status) ? 0 : -1; | |
//return status < 0 ? 0 : -1; | |
} | |
unsigned int sleep(unsigned int seconds) { | |
usleep(seconds * 1000000); | |
return 0; | |
} |