Share via


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]

Comments

  • Anonymous
    May 01, 2006
    On CE 4.2, I've seen code in the sample Explorer shell that also seems to handle DST, a thread that is sleeping until the DST->standard time changes and adjust the time accordingly.

    Did this change in CE 5.0? is there some conflict between timesvc.dll and explorer.exe? or are we supposed to remove the DST handling code of the shell if we include timesvc?

    Thanks,
  • Anonymous
    May 10, 2006
    Philippe -- you have very good eyes.  The DST code has changed between CE 4.2 & CE 5.0.  Now if the standard shell is included, it will automatically bring in timesvc.dll and explorer.exe will no longer spin up the DST handling code.  The idea here is that everyone and their brother had DST logic, so it made sense to move it to a service that everyone can use rather than having explorer.exe have its own copy and other stuff have their own copy.  Don't get me started on the way things were :( -- we have made progress in this area at least.

    If you're super curious, check out %_WINCEROOT%publicCEBaseoakmiscwceshellfe.bat, which is the dependency determination file for shell related stuff.  You'll see that if SYSGEN_STANDARDSHELL is set, then SYSGEN_TIMESVC_DST is also automatically set.

    John Spaith
  • Anonymous
    May 10, 2006
    The comment has been removed
  • Anonymous
    June 06, 2006
    There is one comment here that confuses me.  You mention that it can be an SNTP client only.  This does not appear to work.  I have to include the server to get the client to build.  Unfortunately, the dependency is not set to make this happen automatically.  Either that, or the client is missing a vital piece.  Yes, I do have all of the updates installed through April (May is not available yet).
  • Anonymous
    June 13, 2006
    Bruce (aka casner) -- being forced to build with the server is news to me; I'm surprised since most of the time when people pull in IABase they only bring in the client portion.

    If you want to debug this further, please spin up a thread on microsoft.public.windowsce.platbuilder (which I'm better at checking than here) and include the build.err & relevant build.log portions of what breaks when you set client only, as well as SYSGEN's that you have and public<YourProjectName>cesysgensdkincceconfig.h.

    [John Spaith]
  • Anonymous
    December 26, 2006
    Hello John,Can you please tell me how this works on a Windows Mobile 5.0 terminal? By default we havent enabled SNTP. We use Windows Mobile AKU 3.5 for our BSP. Since SNTP is not describled in Windows Mobile documentation for OEM's, please throw some light on this. And, will the above fix work for WM 5.0 also? If not, how is DST and SNTP handled in Windows mobile devices.
  • Anonymous
    January 02, 2007
    The comment has been removed