I\'m looking for a way to measure microsecs in C++/Windows.
I read about the \"clock\" function, but it returns only milliseconds...
Is there a way to do it?
(since no-one has mentioned a pure c++ approach yet),
as of c++11:
#include
std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch())
gets you the number of microseconds since 1970-01-01, and a port of php's microtime(true) api would be
#include
double microtime(){
return (double(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()) / double(1000000));
}
gets you the number of seconds since 1970-01-01 with microsecond precision