diff options
author | David Turner <digit@android.com> | 2011-06-23 09:10:39 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-06-23 09:10:39 -0700 |
commit | 2be3f09f2d9b6d35b262f7a6148f51c164bb8cbb (patch) | |
tree | 86b176d2fefae9733be2d2ca69faa91053e68f63 | |
parent | ac56f5ca2f4c54ddbd37b033f9465d89542c2cbe (diff) | |
parent | 21edf366ea9b5e4dc04c217289fdaf39f08a0060 (diff) | |
download | bionic-2be3f09f2d9b6d35b262f7a6148f51c164bb8cbb.zip bionic-2be3f09f2d9b6d35b262f7a6148f51c164bb8cbb.tar.gz bionic-2be3f09f2d9b6d35b262f7a6148f51c164bb8cbb.tar.bz2 |
Merge "time: Improve C99 compliance"
-rw-r--r-- | libc/unistd/time.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libc/unistd/time.c b/libc/unistd/time.c index 13d7366..7b450c7 100644 --- a/libc/unistd/time.c +++ b/libc/unistd/time.c @@ -34,12 +34,15 @@ time_t time(time_t *t) { struct timeval tt; + time_t ret; if (gettimeofday(&tt, (struct timezone *)0) < 0) - return (-1); - if (t) - *t = (time_t)tt.tv_sec; - return (tt.tv_sec); + ret = -1; + else + ret = tt.tv_sec; + if (t != NULL) + *t = ret; + return ret; } |