This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 07/12] Use clock_gettime to implement ftime.
On 8/21/19 11:18 AM, Adhemerval Zanella wrote:
>> - __set_errno (0);
>> - if (time (&timebuf->time) == (time_t) -1 && errno != 0)
>> + if (__clock_gettime (CLOCK_REALTIME, &ts) < 0)
>> return -1;
>
> I think we can assume CLOCK_REALTIME is always supported and &ts is always
> valid, so we can skip the test here.
Will change.
>> + timebuf->time = ts.tv_sec;
>> + timebuf->millitm = (ts.tv_nsec + 500000) / 1000000;
>
> I think it is a fair assumption that kernel won't play foul here and give
> us invalid tv_nsec.
Yes, we already assume this in many other places.
zw