The <time.h>
or <ctime>
header files, as specified by the C and C++ standards respectively, does not support subsecond timing.
If you can use C++ and have a C++11 compatible environment, then you can get portable support with the std::chrono
functionality. There's also a boost::chrono
that could be used in older versions of C++.
Otherwise, you'll have to go system-specific, with for example gettimeofday
in Linux/Unix and SystemTime
in Windows. For other OS's, you need to look up what, if any, time functions there are.