开发者

Obtaining a timestamp in C# of when the WinCE device booted up

开发者 https://www.devze.com 2022-12-09 09:52 出处:网络
There is an approach described here: http://www.c-sharpcorner.com/UploadFile/scottlysle/TimeSinceBootCS06052008055807AM/TimeSinceBootCS.aspx

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

However, it is not compatible with th开发者_StackOverflowe .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 :)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消