A quote from C11 standard:The clock function returns the implementation’s best approximation to the processortime used by the program since the beginning of an implementation-defined era relatedonly to the program invocation.A few quotes from the C++11 standard:20.11.3 Clock requirementsIn Table 59 C1 and C2 denote clock types. t1 and t2 are values returned by C1::now() where the call returning t1 happens before (1.10) the call returning t2 and both of these calls occur before C1::time_point::max(). [ Note: this means C1 did not wrap around between t1 and t2. -end note ]Table 59 — Clock requirementsC1::is_steady const bool true if t1 <= t2 is always true and the time between clock ticks is constant, otherwise false.20.11.7.2 Class steady_clockObjects of class steady_clock represent clocks for which values of time_point never decrease as physical time advances and for which values of time_point advance at a steady rate relative to real time. That is, the clock may not be adjusted.The whole point of steady_clock (and difference with system_clock) - the steady_clock "goes on forward" even if the hardware clock on the PC is rewinded back (by user, by program, etc.).The same idea is behind the return value of C language clock() function.As you can see - these requirements of C++11 (and C11) standard are not carried out by VC++ 2012 RC implementation (as the program below shows), which is not surprising at all, seeing that steady_clock::now() and clock() are implemented using GetSystemTimeAsFileTime() Win32 API function. GetTickCount/GetTickCount64/QueryPerformanceCounter functions should be used for that instead.
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results