Need "measuring time" suggestion
-
Hi guys, in my software I need to measure time duration between two hardware signals (which come via RS232 connection). And I'd need that with accuracy to millisecond. I'm wondering what's a reasonably good way (meaning good accurate results) to go about it? I'm now only thinking of using
SetTimer()
andKillTimer()
with a counter variable to count the time, would that be able to provide a good accuracy? Thanks -
Hi guys, in my software I need to measure time duration between two hardware signals (which come via RS232 connection). And I'd need that with accuracy to millisecond. I'm wondering what's a reasonably good way (meaning good accurate results) to go about it? I'm now only thinking of using
SetTimer()
andKillTimer()
with a counter variable to count the time, would that be able to provide a good accuracy? ThanksQueryPerformanceCounter
does a good job. Take a look at this article. regards -
Hi guys, in my software I need to measure time duration between two hardware signals (which come via RS232 connection). And I'd need that with accuracy to millisecond. I'm wondering what's a reasonably good way (meaning good accurate results) to go about it? I'm now only thinking of using
SetTimer()
andKillTimer()
with a counter variable to count the time, would that be able to provide a good accuracy? ThanksOne way would be to use either the _ftime() or _ftime64() function. e.g. __int64 getCurrentMilliTime() { __timeb64 time; _ftime64(&time); __int64 seconds = (__int64)time.time; return (seconds * 1000) + time.millitm; } _ftime()/_ftime64()
-
Hi guys, in my software I need to measure time duration between two hardware signals (which come via RS232 connection). And I'd need that with accuracy to millisecond. I'm wondering what's a reasonably good way (meaning good accurate results) to go about it? I'm now only thinking of using
SetTimer()
andKillTimer()
with a counter variable to count the time, would that be able to provide a good accuracy? ThanksOn NT/W2K/XP, you can use
GetTickCount()
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke -
On NT/W2K/XP, you can use
GetTickCount()
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'RourkeI'll have to remember that one. That's a bit more friendly than the method I gave. (Though not as useful if you actually want the time. ;))
-
On NT/W2K/XP, you can use
GetTickCount()
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke