Re: [PATCH 2/3] system_data_types.7: Add 'clock_t'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Alex,

>> This type has a strange history. In my book, I note:
>>
>>      Although the clock_t return type of clock() is the same
>>      data type that is used in the times() call, the units of
>>      measurement employed by these two interfaces are
>>      different. This is the result of historically conflicting
>>      definitions of clock_t in POSIX.1 and the C programming
>>      language standard.
> 
> 
> Ahhh now I get it.  So CLOCKS_PER_SEC doesn't mean CLOCK_TICKS_PER_SEC, 
> right?  I always thought that it really was that, and clock() simply 
> returned clock ticks.  But it looks like it returns an arbitrary 
> division of the second called CLOCKS_PER_SEC.

More or less. But the standard also says (in the <time.h> spec):

   The value of CLOCKS_PER_SEC shall be 1 million on 
   XSI-conformant systems.

(Yes, it is odd.)

Thanks,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux