Does anyone know an equivalent function of the gettimeofday() function in Windows environment? I am comparing a code execution time in Linux vs Windows. I am using MS Visual Studio 2010 and it keeps saying, identifier “gettimeofday” is undefined.
Does anyone know an equivalent function of the gettimeofday() function in Windows environment? I
Share
GetLocalTime()for the time in the system timezone,GetSystemTime()for UTC. Those return the date/time in aSYSTEMTIMEstructure, where it’s parsed into year, month, etc. If you want a seconds-since-epoch time, useSystemTimeToFileTime()orGetSystemTimeAsFileTime(). TheFILETIMEis a 64-bit value with the number of 100ns intervals since Jan 1, 1601 UTC.For interval taking, use
GetTickCount(). It returns milliseconds since startup.For taking intervals with the best possible resolution (limited by hardware only), use
QueryPerformanceCounter().