Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>From N3376:</p> <p>20.11.7.1 [time.clock.system]/1:</p> <blockquote> <p>Objects of class <code>system_clock</code> represent wall clock time from the system-wide realtime clock.</p> </blockquote> <p>20.11.7.2 [time.clock.steady]/1:</p> <blockquote> <p>Objects of class <code>steady_clock</code> represent clocks for which values of <code>time_point</code> never decrease as physical time advances and for which values of <code>time_point</code> advance at a steady rate relative to real time. That is, the clock may not be adjusted.</p> </blockquote> <p>20.11.7.3 [time.clock.hires]/1:</p> <blockquote> <p>Objects of class <code>high_resolution_clock</code> represent clocks with the shortest tick period. <code>high_resolution_clock</code> may be a synonym for <code>system_clock</code> or <code>steady_clock</code>.</p> </blockquote> <p>For instance, the system wide clock might be affected by something like daylight savings time, at which point the actual time listed at some point in the future can actually be a time in the past. (E.g. in the US, in the fall time moves back one hour, so the same hour is experienced "twice") However, <code>steady_clock</code> is not allowed to be affected by such things.</p> <p>Another way of thinking about "steady" in this case is in the requirements defined in the table of 20.11.3 [time.clock.req]/2:</p> <blockquote> <p>In Table 59 <code>C1</code> and <code>C2</code> denote clock types. <code>t1</code> and <code>t2</code> are values returned by <code>C1::now()</code> where the call returning <code>t1</code> happens before the call returning <code>t2</code> and both of these calls occur before <code>C1::time_point::max()</code>. [ Note: this means <code>C1</code> did not wrap around between <code>t1</code> and <code>t2</code>. —end note ] </p> <p>Expression: <code>C1::is_steady</code><br> Returns: <code>const bool</code><br> Operational Semantics: <code>true</code> if <code>t1 &lt;= t2</code> is always true and the time between clock ticks is constant, otherwise <code>false</code>.</p> </blockquote> <p>That's all the standard has on their differences.</p> <p>If you want to do benchmarking, your best bet is probably going to be <code>std::high_resolution_clock</code>, because it is likely that your platform uses a high resolution timer (e.g. <code>QueryPerformanceCounter</code> on Windows) for this clock. However, if you're benchmarking, you should really consider using platform specific timers for your benchmark, because different platforms handle this differently. For instance, some platforms might give you some means of determining the actual number of clock ticks the program required (independent of other processes running on the same CPU). Better yet, get your hands on a real profiler and use that.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload