summaryrefslogtreecommitdiff
path: root/missing_d/usleep.c
blob: cb1c7abf2fb5afa38aa016cf9f031b8f2b7a3d78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * usleep - round microseconds up to an integral number of seconds.
 *
 * The real usleep() doesn't work this way; this is a hack for systems
 * that don't have usleep().
 */

int
usleep(unsigned int usec)
{
	unsigned int seconds = usec / 1000000;

	/* Round up: */
	seconds += (usec % 1000000 > 0);	/* 1 or 0 */

	return sleep(seconds);
}