Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Using High-resolution Timers

For multimedia streaming, games, and profiling, Standard C++'s time-meausurement facilities are limited. For high-resolution timers, look to the POSIX libraries




Application Security Testing: An Integral Part of DevOps

tandard C++ offers a rather limited number of functions for accurate time measurement: clock() gives you a granularity of up to a thousandth of a second at best, and difftime() compares two different time() readings. However, when it comes to multimedia streaming, games and profiling, you want higher resolution timers. The following sections present POSIX high-resolution timers. These timers are available on POSIX systems and to some extent, on Windows, too.

You need high-resolution timers that measure microseconds and even nanoseconds. However, the standard <ctime> facilities are a long way from providing that kind of capability.

When the ISO C++ standard doesn't provide the answers, use another portable and reliable standard library—POSIX.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date