Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Category list

TickCount instead of millisecond in compact framework

by Ahmadreza Atighechi 30. March 2009 13:42

 

After long absence I'm back now. Recently I wanted to develop an application for windows mobile with .Net Compact framework. In this application I need to measure elapsed time in millisecond resolution. First of all like everyone I tried to use Millisecond property of DateTime.Now static class. But it won't work at all in .Net Compact framework even in version 3.5!

If you want to use a timer with millisecond resolution you have to use TickCount property of Environment class.

 

//Will be zero.

lblMillisecondVal.Text = DateTime.Now.Millisecond.ToString();

//Total milliseconds elapsed since the system started.

lblTickCountVal.Text = Environment.TickCount.ToString();

 

 

Here is an example of using TickCount Instead of Milliseconds

 

Tags: ,

Blog

The information on this web site is provided "AS IS" with no warranties, and confers no rights.

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen