summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap/plan9/_nap.c
blob: d21eff79c371aa90ba8a765db9ffa9471d07a727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "lib.h"
#include <unistd.h>
#include <time.h>
#include "sys9.h"

/*
 * This is an extension to POSIX
 */
unsigned int
_nap(unsigned int millisecs)
{
	time_t t0, t1;

	t0 = time(0);
	if(_SLEEP(millisecs) < 0){
		t1 = time(0);
		return t1-t0;
	}
	return 0;
}