
On Sat, 24 Jul 2004 11:24:39 +0100, John Maddock <john@johnmaddock.co.uk> wrote:
Just out of interest, what is the problem that prevents the date-time library from implementing a microsecond clock using GetSystemTimeAsFileTime on Win32?
Thanks,
John.
The resolution supplied by GetSystemTimeAsFileTime may not be what you think. I get 10 milliseconds resolution out of my machine from the following code. #include <Windows.h> #include <iostream> int main () { FILETIME ft1,ft2; GetSystemTimeAsFileTime( &ft1 ); GetSystemTimeAsFileTime( &ft2 ); std::size_t diff = ft2.dwLowDateTime - ft1.dwLowDateTime; while (diff == 0) { GetSystemTimeAsFileTime( &ft2 ); diff = ft2.dwLowDateTime - ft1.dwLowDateTime; } std::cout << "time taken = " << double(ft2.dwLowDateTime - ft1.dwLowDateTime) /10000 << "milliseconds\n"; system("pause"); return 0; } Regards, Matt Hurd.