xref: /haiku/src/system/libroot/posix/unistd/usleep.c (revision 95c9effd68127df2dce202d5e254a7c86560010a)
1 /*
2 ** Copyright 2001, Manuel J. Petit. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 
6 #include <unistd.h>
7 #include <syscalls.h>
8 #include <errno.h>
9 
10 #include <errno_private.h>
11 
12 
13 int
14 usleep(unsigned useconds)
15 {
16 	int err;
17 	err = snooze_until(system_time() + (bigtime_t)(useconds), B_SYSTEM_TIMEBASE);
18 	if (err < 0) {
19 		__set_errno(err);
20 		return -1;
21 	}
22 	return 0;
23 }
24