[PATCH 06/12] Use clock_gettime to implement time.

Zack Weinberg zackw@panix.com
Thu Aug 22 12:58:00 GMT 2019


On 8/20/19 2:02 PM, Adhemerval Zanella wrote:
>>  /* Return the time now, and store it in *TIMER if not NULL.  */
>>  time_t
>>  time (time_t *timer)
>>  {
>> -  __set_errno (ENOSYS);
>> +  struct timespec ts;
>> +  time_t res;
>>  
>> -  if (timer != NULL)
>> -    *timer = (time_t) -1;
>> -  return (time_t) -1;
>> +  if (__clock_gettime (CLOCK_REALTIME, &ts))
> 
> No implicit check. Also I think we can assume CLOCK_REALTIME support on
> all current architectures (including Hurd), so there is no actually need
> to check clock_gettime return value.

OK, will change.

zw



More information about the Libc-alpha mailing list