views:

88

answers:

1

There is an approach described here: http://www.c-sharpcorner.com/UploadFile/scottlysle/TimeSinceBootCS06052008055807AM/TimeSinceBootCS.aspx

However, it is not compatible with the .NET Compact Framework.

Can anyone recommend a way to obtain the time (in seconds) since the system/device was booted up that's compatible with the compact framework?

Thanks in advance :)

A: 

Assuming that bug-ridden OS is okay with battery, time (as entire Windows family is skewing challenged), and assuming you will ensure to call it carefully enough to avoid wrapping (or use other mechanisms like persistance) on c20-30 days you get with GetTickCount/PInvoke or System.Environment.TickCount... just construct the DateTime from DateTime.Now (or utc variant, depending on what you're doing) and subtract the seconds/milliseconds.

rama-jka toti