Why is CLOCKS_PER_SEC not the actual number of clocks per second?

后端 未结 6 1581
情话喂你
情话喂你 2020-11-30 03:53

I have just written this short C++ program to approximate the actual number of clock ticks per second.

#include 
#include 

usi         


        
6条回答
  •  無奈伤痛
    2020-11-30 04:24

    clock returns the amount of time spent in your program. There are 1,000,000 clock ticks per second total*. It appears that your program consumed 60% of them.

    Something else used the other 40%.

    *Okay, there are virtually 1,000,000 clock ticks per second. The actual number is normalized so your program perceives 1,000,000 ticks.

提交回复
热议问题