gettimeofday,如何翻译 linux 函数
gettimeofday, how to translate a linux function
如何将此函数从 linux 转换为 Windows?我无法使用 gettimeofday 函数
double getSysTime() {
struct timeval tp; gettimeofday(&tp,NULL);
return double(tp.tv_sec) + double(tp.tv_usec)/1E6;
}
使用 http://support.microsoft.com/kb/167296 中给出的示例:
double getSysTime() {
FILETIME time;
int64_t now;
GetSystemTimeAsFileTime(&time);
now = ((LONGLONG) time.dwHighDateTime) << 32 | time.dwLowDateTime;
now = now - 116444736000000000;
/* (now * 100) is number of nanoseconds since Unix epoch */
return ((double) now) / 1e7;
}
如何将此函数从 linux 转换为 Windows?我无法使用 gettimeofday 函数
double getSysTime() {
struct timeval tp; gettimeofday(&tp,NULL);
return double(tp.tv_sec) + double(tp.tv_usec)/1E6;
}
使用 http://support.microsoft.com/kb/167296 中给出的示例:
double getSysTime() {
FILETIME time;
int64_t now;
GetSystemTimeAsFileTime(&time);
now = ((LONGLONG) time.dwHighDateTime) << 32 | time.dwLowDateTime;
now = now - 116444736000000000;
/* (now * 100) is number of nanoseconds since Unix epoch */
return ((double) now) / 1e7;
}