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

13 lines
367 B
C

#include <machine/syscall.h>
#include <sys/time.h>
int
nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{
unsigned long current_time, end_time;
asm ("rdtime %0" : "+r" (current_time));
end_time = current_time + rqtp->tv_sec * 1000000000ULL + rqtp->tv_nsec;
while (current_time <= end_time) asm ("rdtime %0" : "+r" (current_time));
return 0;
}