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).

Gabriel Sanmartin
  • 3,804
  • 14
  • 51
  • 105

2 Answers2

6

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

Reed Copsey
  • 539,124
  • 75
  • 1,126
  • 1,354
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
  • 12,852
  • 6
  • 51
  • 99