TickCount instead of millisecond in compact framework

Blog comments edit

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](http://gkasoq.bay.livefilestore.com/y1p-j36TiPUqAUB6w5kYE05nlr4sJQ6zrqwpr1ggB654bL0E7JHIehasbHjEaireeiTg9vR_nxCaAskngmyKX-o1Q/TickCountTest.zip?download&psid=1) is an example of using TickCount Instead of Milliseconds

Comments