Daylight Savings Time Roll-overs on Windows CE

Summary: On rereading this post, I realized it's pretty complicated.  The summary here is that you have the Time Service DST logic included in your CE image, then you need to add the registry keys at the bottom of this post & to install the timesvc QFE's.  You can see if you have this by opening your ceconfig.h in your releasedirectory and seeing if you have the line "#define TIMESVC_TSVC_DST 1" included.  If you have this line you have the DST stuff, otherwise you don't.

Audience: This blog applies only to general embedded customers.  On Windows Mobile devices (all versions) Daylight Savings Time transformations are handled by a separate component.  It also assumes that you are using the CE SNTP component (timesvc.dll) (https://msdn.microsoft.com/library/en-us/wcecomm5/html/wce50oriSimpleNetworkTimeProtocolSNTPService.asp?frame=true) in CE 5.0.  I promise in CE 6.0 RTM you won't have to go through any of this.

Background: Timesvc.dll is a kind of complicated DLL in that it can have from 1-3 different SYSGEN components.  Basically you can have it be a true time server where it services network clients (this would usually be in say WinCE running in a home gateway).  It can also be an SNTP client, or it can only automatically handle daylight savings time (DST) transitions (it detects when your clock passes from DST<->standard time or vice versa and automatically resets it).  The DST part is the most interesting for this post.

You may be have the DST configuration code in your OS even if you didn't explicitly request it, because if you have SYSGEN_IABASE set (which I believe you'll get with "Internet Appliance Design Template") then the DST logic will be automatically brought in.  See my notes at start of this article on determining whether you have it or not.

Problem: When you bring in the DST transition logic, it is *not* automatically enabled.  You need a registry key that's not obvious in order to have this enabled.  Because people aren't enabling this, the universal time in addition to local time is getting stored incorrectly.  (Universal time is stored incorrectly because many (if not all?) OALs store the time in local time and to get the universal time the kernel applies the current timezone bias.)

Solution: For all this background, the fix is pretty easy.
1 - First things first, if you're using timesvc make sure that you've installed all QFE's relating to it.  There have been 2 serious bugs fixed in it via QFE's.

2 - Add the following registry to your project.reg and rebuild your image.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Clock]
"AutoDST"=dword:1

[Author: John Spaith]