mercredi 13 février 2019

Comparison of `std::chrono` clocks with `boost::xtime`

How do the C++11 std::chrono clocks steady_clock and high_resolution_clock compare with boost::xtime::xtime_get() in terms of quirks and general properties on various platforms?

The standard does not guarantee that high_resolution_clock be steady (it explicitly mentions it may be an alias to system_clock), so that's one pitfall to look out for. Other properties that come to my mind:

  • Resolution: The C++11 standard does not seeem to guarantee any resolution; what are the "real-life" resolutions of these clocks? How does boost::xtime_get() fare on the same systems?

  • Maximum Duration: I know that e.g. clock() breaks down after roughly an hour on systems with a 32-bit clock_t and a 1 MHz nominal clock resolution. (Yes, I know clock() is supposed to do a somewhat different job.) Can the C++11 standard clocks cope with durations in the order of days, maybe even weeks on all known platforms?

  • Any other known issues or surprising quirks?

Aucun commentaire:

Enregistrer un commentaire