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

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