From 779c35b7c4e47d9fc8f69ee582e822a2f6f45411 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 2 Feb 2010 23:07:24 +0100 Subject: time,times: stop interpreting negative return values ar errors Signed-off-by: Denys Vlasenko --- libc/sysdeps/linux/common/time.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'libc/sysdeps/linux/common/time.c') diff --git a/libc/sysdeps/linux/common/time.c b/libc/sysdeps/linux/common/time.c index 0d9e412bf..e13b44f4d 100644 --- a/libc/sysdeps/linux/common/time.c +++ b/libc/sysdeps/linux/common/time.c @@ -13,19 +13,18 @@ #ifdef __NR_time -_syscall1(time_t, time, time_t *, t) +_syscall_noerr1(time_t, time, time_t *, t) #else - time_t time(time_t * t) { time_t result; struct timeval tv; - if (gettimeofday(&tv, (struct timezone *) NULL)) { - result = (time_t) - 1; - } else { - result = (time_t) tv.tv_sec; - } + /* In Linux, gettimeofday fails only on bad parameter. + * We know that here parameter isn't bad. + */ + gettimeofday(&tv, NULL); + result = (time_t) tv.tv_sec; if (t != NULL) { *t = result; } -- cgit v1.2.3