Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/sys/linux/time.c')
-rw-r--r--newlib/libc/sys/linux/time.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/newlib/libc/sys/linux/time.c b/newlib/libc/sys/linux/time.c
new file mode 100644
index 000000000..106658f39
--- /dev/null
+++ b/newlib/libc/sys/linux/time.c
@@ -0,0 +1,28 @@
+/* libc/sys/linux/time.c - Time-related system calls */
+
+/* Written 2000 by Werner Almesberger */
+
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <linux/times.h>
+#include <sys/syscall.h>
+
+
+_syscall1(time_t,time,time_t *,t)
+_syscall1(clock_t,times,struct tms *,buf)
+_syscall2(int,gettimeofday,struct timeval *,tv,struct timezone *,tz)
+_syscall2(int,nanosleep,const struct timespec *,req,struct timespec *,rem)
+
+
+unsigned int sleep(unsigned int seconds)
+{
+ struct timespec ts;
+
+ ts.tv_sec = seconds;
+ ts.tv_nsec = 0;
+ if (!nanosleep(&ts,&ts)) return 0;
+ if (errno == EINTR) return ts.tv_sec;
+ return -1;
+}