summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/time.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-02 23:07:24 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-02 23:07:24 +0100
commit779c35b7c4e47d9fc8f69ee582e822a2f6f45411 (patch)
treea28b743c3e26d002cacebc15fa0c16759b9d163c /libc/sysdeps/linux/common/time.c
parent7fdca78a993ef53f6c26bb19a70862557dc794e8 (diff)
time,times: stop interpreting negative return values ar errors
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/time.c')
-rw-r--r--libc/sysdeps/linux/common/time.c13
1 files changed, 6 insertions, 7 deletions
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;
}