PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Timer, timespan and milliseconds
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Timer, timespan and milliseconds
![]() |
Timer, timespan and milliseconds |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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/d...emberstopic.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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 "Andreas Ringdal" <collector@ringdal.no> wrote in message news:43cb618d$1@news.wineasy.se... > 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/d...emberstopic.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 |
|
|
|
#3 |
|
Guest
Posts: n/a
|
....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/ "<ctacke/>" <ctacke_AT_OpenNETCF_com> wrote in message news:uqZi8ZpGGHA.1676@TK2MSFTNGP09.phx.gbl... > 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 > > "Andreas Ringdal" <collector@ringdal.no> wrote in message > news:43cb618d$1@news.wineasy.se... >> 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/d...emberstopic.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 > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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. > > -Chris > > "Andreas Ringdal" <collector@ringdal.no> wrote in message > news:43cb618d$1@news.wineasy.se... > > 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/d...emberstopic.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 |
|
|
|
#5 |
|
Guest
Posts: n/a
|
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 <andemann@gmail.com> wrote in message news:1137852073.327595.113320@g44g2000cwa.googlegroups.com... >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. >> >> -Chris >> >> "Andreas Ringdal" <collector@ringdal.no> wrote in message >> news:43cb618d$1@news.wineasy.se... >> > 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/d...emberstopic.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 > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
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 > 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 > > > <andemann@gmail.com> wrote in message > news:1137852073.327595.113320@g44g2000cwa.googlegroups.com... >> 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. >>> >>> -Chris >>> >>> "Andreas Ringdal" <collector@ringdal.no> wrote in message >>> news:43cb618d$1@news.wineasy.se... >>>> 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/d...emberstopic.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. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


