Use GetSystemTimeAsFileTime to implement gettimeofday on win32. It is (in my benchmarks) way faster than _ftime, though the conversion process is not so straightforward. In theory, it can have a better granularity too, though in practice who knows what you're getting.