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 libraryPOSIX.