Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / January 2006

Tip: Looking for answers? Try searching our database.

Timer, timespan and milliseconds

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andreas Ringdal - 16 Jan 2006 09:04 GMT
I've made a simple stopwatch for .net cf 2 using DateTime dtStart
and Timespan tsInterval = DateTime.Now - dtStart

tsInterval.Milliseconds is always 0.
Does .net cf not support milliseconds.

I tried searching for this, and according to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemtimespanmemberstopic.asp

milliseconds is supported by .NET CF

Tested the code on my win 2003 box and the stopwatch works as planned,
but on my device (qtek 9100 / HTC Wizard), WM5. Milliseconds is always 0.

Is this a bug or a feature?

Andreas
<ctacke/> - 16 Jan 2006 12:15 GMT
CF supports it - most CE devices don't.  Theres a good reason for it that I
won't go into, but the workaround is to use Environment.TickCount property.

-Chris

> I've made a simple stopwatch for .net cf 2 using DateTime dtStart
> and Timespan tsInterval = DateTime.Now - dtStart
[quoted text clipped - 12 lines]
>
> Andreas
Daniel Moth - 16 Jan 2006 21:15 GMT
...also check out the Stopwatch in the SDF from OpenNETCF:
http://www.danielmoth.com/Blog/2004/12/stopwatch.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

> CF supports it - most CE devices don't.  Theres a good reason for it that
> I won't go into, but the workaround is to use Environment.TickCount
[quoted text clipped - 18 lines]
>>
>> Andreas
andemann@gmail.com - 21 Jan 2006 14:01 GMT
I made a working stopwatch using the Environment.TickCount property and
discovered that when my device is automatically turned off avter 3
minutes av inactivity, that counter also sleeps/slows down resuling in
my stopwatch claiming that there are 11 minutes 34 secons from 14:26:45
to 14:48:07

Going to check out the Stopwatch in the SDF from OpenNETCF as suggested
by Daniel Moth sometimes during the weekend.

Andreas

<ctacke/> skrev:
> CF supports it - most CE devices don't.  Theres a good reason for it that I
> won't go into, but the workaround is to use Environment.TickCount property.
[quoted text clipped - 17 lines]
> >
> > Andreas
<ctacke/> - 21 Jan 2006 16:38 GMT
The tickcount is not really appropriate for counting milliseconds on a scale
over minutes like that with any accuracy.  It's actually returning the
number of system ticks since boot.  While that in theory is the number of
milliseconds, some drift can be expected, and how the implementation of the
OAL is handled can have a big impact on this - adding a sleep/wake cycle in
the middle of it could also add complication.  Do you really need millisecod
resolution over such long periods of time, and even through a sleep/wake?

-Chris

>I made a working stopwatch using the Environment.TickCount property and
> discovered that when my device is automatically turned off avter 3
[quoted text clipped - 32 lines]
>> >
>> > Andreas
Andreas Ringdal - 21 Jan 2006 17:00 GMT
No, most of the time I wont need milliseconds, but I'm working on
several smaller projects in order to get to know the compact frameworks
limitations and possibilities. Want to make an all purpose stopwatch
while I'm at it.

The main reason for writing the stopwatch application is to log my wifes
labour contractions and as a techhead I really can't do that using an
ordinary watch and writing down the time for each contraction.
Hope the application gets ready in time :)

<ctacke/> skrev:
> The tickcount is not really appropriate for counting milliseconds on a scale
> over minutes like that with any accuracy.  It's actually returning the
[quoted text clipped - 38 lines]
>>>> but
>>>> on my device (qtek 9100 / HTC Wizard), WM5. Milliseconds is always 0.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.