how does clock return the same value every 72 minutes?

I am reading up on the clock() function:

http://www.tutorialspoint.com/c_standard_library/c_function_clock.htm

It states:

"On a 32bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value approximately every 72 minutes."

How could this return the same value, if clock is the number of clock ticks elapsed since program execution. Wouldn't the number of clock ticks continue to grow, and as such, when we divide by 1000000, the return value should continue to grow. So how does this function return same value every 72 minutes?
Imagine scoreboard where two decimal digits can be displayed.
Question: when score is 99 and you score 1 more point, what will be displayed?

Same goes for variables in C. It has maximum value and can not hold values larger than that. C standard describes overflow behavior. In our scoreboard example it is 99 + 1 = 00.

So clock will eventually loop on itself. On a 32bit system where CLOCKS_PER_SEC equals 1000000 full cycle takes about 72 minutes.
The maximum value that can be returned by std::clock() is std::numeric_limits<std::clock_t>::max()

After it reaches that maximum value, it will wrap back to zero.
http://coliru.stacked-crooked.com/a/9831c5ea7f233aeb
Topic archived. No new replies allowed.