1 /* Copyright (c) 2008 Patrick Mansfield <patmans@us.ibm.com> */ 2 /* Copied from libc/posix/sleep.c, removed the check for HAVE_NANOSLEEP */ 3 4 /* Written 2000 by Werner Almesberger */ 5 6 #include <picolibc.h> 7 8 #include <errno.h> 9 #include <time.h> 10 #include <unistd.h> 11 sleep(unsigned seconds)12unsigned sleep(unsigned seconds) 13 { 14 struct timespec ts; 15 16 ts.tv_sec = seconds; 17 ts.tv_nsec = 0; 18 if (!nanosleep(&ts,&ts)) return 0; 19 if (errno == EINTR) return ts.tv_sec; 20 return -1; 21 } 22