OSDN Git Service

hidden_def/hidden_proto: convert all users (I hope) termios split, add some missing...
[uclinux-h8/uClibc.git] / libc / unistd / usleep.c
1 /*
2  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
3  *
4  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
5  */
6
7 #include <time.h>
8 #include <sys/time.h>
9 #include <sys/types.h>
10 #include <unistd.h>
11
12 libc_hidden_proto(nanosleep)
13
14 int usleep (__useconds_t usec)
15 {
16     const struct timespec ts = {
17         .tv_sec = (long int) (usec / 1000000),
18         .tv_nsec = (long int) (usec % 1000000) * 1000ul
19     };
20     return(nanosleep(&ts, NULL));
21 }