summaryrefslogtreecommitdiffstats
path: root/libc/unistd
diff options
context:
space:
mode:
authorDavid Turner <digit@android.com>2011-06-23 10:01:11 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-06-23 10:01:11 -0700
commitc643a4d4c71c2caaf016ab402fba99c1c9377567 (patch)
treefc7e2565f2ab96e7613e8e6f282fee88165021d3 /libc/unistd
parentcd9f1f0b2726fbaac75b47231eb80a91841231f9 (diff)
parent2be3f09f2d9b6d35b262f7a6148f51c164bb8cbb (diff)
downloadbionic-c643a4d4c71c2caaf016ab402fba99c1c9377567.zip
bionic-c643a4d4c71c2caaf016ab402fba99c1c9377567.tar.gz
bionic-c643a4d4c71c2caaf016ab402fba99c1c9377567.tar.bz2
am 2be3f09f: Merge "time: Improve C99 compliance"
* commit '2be3f09f2d9b6d35b262f7a6148f51c164bb8cbb': time: Improve C99 compliance
Diffstat (limited to 'libc/unistd')
-rw-r--r--libc/unistd/time.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libc/unistd/time.c b/libc/unistd/time.c
index 4b51675..18aa62c 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;
}
// return monotonically increasing CPU time in ticks relative to unspecified epoch