Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is CLK_PER_SEC?

Tags:

c

While reading some pages in The C Programming Language 2e, I found this.

clock_t clock(void) : clock returns the processor time used by the program since the beginning of execution, or -1 if unavailable. clock()/CLK_PER_SEC is a time in seconds.

What is CLK_PER_SEC? It doesn't look like a typo.


1 Answers

The manpage for clock(3) seems to mention CLOCKS_PER_SEC. glibc follows the same convention. It seems that the text you quoted is from K&R 2nd edition, which is quite dated now. It is possible that the standard library used CLK_PER_SEC back then, but it is certainly not the case right now.

like image 100
Filipe Gonçalves Avatar answered Dec 08 '25 09:12

Filipe Gonçalves



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!