From d2fa9df1137149aa9d1689554bd5404c57510d3a Mon Sep 17 00:00:00 2001 From: Eric Heien Date: Fri, 28 Feb 2003 23:30:05 +0000 Subject: [PATCH] windows dtime fix svn path=/trunk/boinc/; revision=992 --- lib/util.C | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/util.C b/lib/util.C index 981a07b880..2861bc1ad8 100755 --- a/lib/util.C +++ b/lib/util.C @@ -105,10 +105,16 @@ int double_to_ydhms (double x, int smallest_timescale, char *buf) { // return time of day as a double +// Not necessarily in terms of UNIX time (especially on Windows) // double dtime() { #ifdef _WIN32 - return (double)time(0); + LARGE_INTEGER time; + FILETIME sysTime; + GetSystemTimeAsFileTime(&sysTime); + time.LowPart = sysTime.dwLowDateTime; + time.HighPart = sysTime.dwHighDateTime; // Time is in 100 ns units + return (double)time.QuadPart/10000000; // Convert to 1 s units #else struct timeval tv; gettimeofday(&tv, 0);