How to get accurate elapsed time ?

  • Thread starter Thread starter silverfox
  • Start date Start date
S

silverfox

I was surprised to find that DateTime.Now.Ticks on my Pocket PC always
returns a value like 633212192210000000. And about 4 seconds later the
value returned is 633212192250000000. You always get seven zeros on
the end, meaning that there are no significant digits past the
seconds. I need at lease tenth second accuracy for my application.
Is there a way? I am using VB, for what it is worth.
 
DataTime.Now on most Windows CE devices is only valid to the second. If you
need sub-second resolution, use Environment.TickCount, which is milliseconds
(watch for wrap). If you need even finere, the P/Invoke
QueryPerformanceCounter.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
DataTime.Now on most Windows CE devices is only valid to the second. If you
need sub-second resolution, use Environment.TickCount, which is milliseconds
(watch for wrap). If you need even finere, the P/Invoke
QueryPerformanceCounter.

--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded Worldwww.OpenNETCF.com


Perfect! I knew that there must be a way and I was pretty certain
that someone on this list would know what it was. Thanks!
 
Back
Top