// nach: http://kjellkod.wordpress.com/2012/02/06/exploring-c11-part-1-time/ #include #include #include void silly_sleep_ms(unsigned int millis) { typedef std::chrono::high_resolution_clock clock; typedef std::chrono::milliseconds ms; clock::time_point t0 = clock::now(); std::this_thread::sleep_for(ms(millis)); clock::time_point t1 = clock::now(); ms total_ms = std::chrono::duration_cast(t1 - t0); std::cout <<"this_thread_sleep (" << millis <<") milliseconds: " << total_ms.count() << "ms\n"; } int main() { for (int i = 0; i < 20; ++i) silly_sleep_ms(50); }