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 <errno.h> 7 #include <time.h> 8 #include <unistd.h> 9 sleep(unsigned seconds)10unsigned sleep(unsigned seconds) 11 { 12 struct timespec ts; 13 14 ts.tv_sec = seconds; 15 ts.tv_nsec = 0; 16 if (!nanosleep(&ts,&ts)) return 0; 17 if (errno == EINTR) return ts.tv_sec; 18 return -1; 19 } 20