2

I need to measure two separate events in time and compare them (not in the same application), so I would like to know the timestamp from the same reference (different applications on the same machine).

What's the simplest way of doing this on a Windows system? I've read about gettimeofday but that seems to be a Unix-specific function.

Also I don't want to use boost or any other external library (windows libraries are fine).

M Rajoy
  • 4,028
  • 14
  • 54
  • 111

2 Answers2

6

You could use GetSystemTime, which returns a SYSTEMTIME (with milliseconds).

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
1

GetTickCount gives you a one millisecond timer. It's perfect for timestamps since you don't need to convert anything. Even timespans can be calculated within a 49,6 days period.

harper
  • 13,345
  • 8
  • 56
  • 105