We added a feature in our application to allow a user to change when the daylight saving time starts and ends; which can be done by modifying the TIME_ZONE_INFORMATION structure, and to be more specific the StandardDate and DaylightDate members(we opted to use the relative date format for these). It was working fine, however, we encountered a high cpu load issue after a specific setting:
From my analysis I was able to reproduce this issue when:
- DaylightDate comes after the StandardDate (e.g DaylightDate = August, StandardDate = March)
- AutoDST is disabled
- Set the date in the device to a date that comes after the DaylightDate (e.g September)
Below is a sample registry to quickly reproduce the problem:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Clock]
"AutoDST"=dword:00000000
[HKEY_LOCAL_MACHINE\Time]
"TimeZoneInformation"=hex:20,fe,ff,ff,4d,00,61,00,6c,00,61,00,79,00,20,00,50,\
00,65,00,6e,00,69,00,6e,00,73,00,75,00,6c,00,61,00,20,00,53,00,74,00,61,00,\
6e,00,64,00,61,00,72,00,64,00,20,00,54,00,69,00,6d,00,65,00,00,00,00,00,00,\
00,00,00,03,00,00,00,01,00,02,00,00,00,00,00,00,00,00,00,00,00,4d,00,61,00,\
6c,00,61,00,79,00,20,00,50,00,65,00,6e,00,69,00,6e,00,73,00,75,00,6c,00,61,\
00,20,00,44,00,61,00,79,00,6c,00,69,00,67,00,68,00,74,00,20,00,54,00,69,00,\
6d,00,65,00,00,00,00,00,00,00,00,00,08,00,06,00,05,00,0c,00,00,00,00,00,00,\
00,c4,ff,ff,ff