C99 compliance: time() always sets its return value in both places
(if present), even on error. Pointed out by: Wojtek Lerch, on the Austin Group mailing-list
This commit is contained in:
parent
a84180a7b2
commit
6a270f2499
@ -45,10 +45,13 @@ time(t)
|
||||
time_t *t;
|
||||
{
|
||||
struct timeval tt;
|
||||
time_t retval;
|
||||
|
||||
if (gettimeofday(&tt, (struct timezone *)0) < 0)
|
||||
return (-1);
|
||||
if (t)
|
||||
*t = tt.tv_sec;
|
||||
return (tt.tv_sec);
|
||||
retval = -1;
|
||||
else
|
||||
retval = tt.tv_sec;
|
||||
if (t != NULL)
|
||||
*t = retval;
|
||||
return (retval);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user