summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/usleep.c
blob: 8f07416a8a7f6e10739fa4147a4bd0ad7b953411 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <time.h>
#include <unistd.h>

/* nano * 1000 == usecs
 * usecs * 1000 == msecs
 * msecs * 1000 = secs */
int usleep(unsigned long usecs) {
  struct timespec t;
  t.tv_sec=usecs/1000000;
  t.tv_nsec=(usecs%1000000)*1000;
  return nanosleep(&t,&t);
}