Groups | Blog | Home
all groups > dotnet compact framework > july 2007 >

dotnet compact framework : How to get accurate elapsed time ?



ctacke/
7/28/2007 3:30:06 PM
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



[quoted text, click to view]

silverfox
7/28/2007 6:48:46 PM
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.
silverfox
7/29/2007 12:00:00 AM
[quoted text, click to view]


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!

AddThis Social Bookmark Button