Windows flag for Daylight Saving?
Moderators: JRL, Dorian (MJT support)
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Windows flag for Daylight Saving?
Is there any accessible windows function/flag that shows whether the PC time is, or is not, currently adjusted for daylight savings aka DST aka BST?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Go to registy key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
Look for value:
DisableAutoDaylightTimeSet
If NOT present or set to zero automatic daylight saving adjustment is enabled. If Present and set to 1 daylight saving adjustment is disabled.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
Look for value:
DisableAutoDaylightTimeSet
If NOT present or set to zero automatic daylight saving adjustment is enabled. If Present and set to 1 daylight saving adjustment is disabled.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Thanks, that's part of the puzzle, but it's not the whole answer. I'm trying to get at whether the system time is currently adjusted, in other words is the PC time offset by one hour because DST is in effect where the PC is located. Need to know for a solar calculation.
I guess the other way would be to ignore the PC time and grab UTC off a time server and adjust it based on the windows time zone setting.
I guess the other way would be to ignore the PC time and grab UTC off a time server and adjust it based on the windows time zone setting.
Just a thought.
I understand it will be much simpler if there is a registry key or some other flag the can be read for "DST on" or "DST off". In lieu of that flag's existence, could you convert "now" to Julien date and compare with Julien date for current year's first Sunday in April and Last Sunday in October? If > April and < October it's DST. Actually, for most times all you'd need is the month. If its not October or April you can know immediately by what month it is. This information in conjuction with the registry info from Marcus should be the whole answer.
Hope this was helpful,
Dick
I understand it will be much simpler if there is a registry key or some other flag the can be read for "DST on" or "DST off". In lieu of that flag's existence, could you convert "now" to Julien date and compare with Julien date for current year's first Sunday in April and Last Sunday in October? If > April and < October it's DST. Actually, for most times all you'd need is the month. If its not October or April you can know immediately by what month it is. This information in conjuction with the registry info from Marcus should be the whole answer.
Hope this was helpful,
Dick
Another thought then....
Completely untested and off the wall....
Acquire the setting of the registry flag for DST.
Check the time
If original setting was off..
Turn on the flag
Check the time
If the original setting was on
Turn off the flag
check the time
Reset the flag to original setting and compare time check results.
Completely untested and off the wall....
Acquire the setting of the registry flag for DST.
Check the time
If original setting was off..
Turn on the flag
Check the time
If the original setting was on
Turn off the flag
check the time
Reset the flag to original setting and compare time check results.
Me_again,
Dont know if you have already resolved this but after a little Internet searching, I think I have found the answer to your question. The registry key that Marcus referenced:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
has a couple of values:
ActiveTimeBias = the currently active offset from GMT in minutes.
Bias = the standard offset from GMT in minutes.
I'm in Iowa in the US. My value for ActiveTimeBias is 360 now that we're on standard time. I reset my date and time for April 2, 2006 at 1:59:50 AM and watched my clock roll to 3:00:00 AM after 10 seconds. Checked the registry and ActiveTimeBias had become 300. The value of Bias remained 360 before and after the time change.
If these two values are equal, the computer is on standard time. If they are not equal, the computer is on daylight saving time.
Hope this helped,
Dick
Dont know if you have already resolved this but after a little Internet searching, I think I have found the answer to your question. The registry key that Marcus referenced:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation
has a couple of values:
ActiveTimeBias = the currently active offset from GMT in minutes.
Bias = the standard offset from GMT in minutes.
I'm in Iowa in the US. My value for ActiveTimeBias is 360 now that we're on standard time. I reset my date and time for April 2, 2006 at 1:59:50 AM and watched my clock roll to 3:00:00 AM after 10 seconds. Checked the registry and ActiveTimeBias had become 300. The value of Bias remained 360 before and after the time change.
If these two values are equal, the computer is on standard time. If they are not equal, the computer is on daylight saving time.
Hope this helped,
Dick
Last edited by JRL on Mon Dec 12, 2005 4:16 pm, edited 2 times in total.
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Cool, thanks, I'll play with that later, I was going down a much more convoluted path 
Update: It works
RegistryReadKey>HKEY_LOCAL_MACHINE,System\CurrentControlSet\Control\TimeZoneInformation,ActiveTimeBias,ActiveBias
RegistryReadKey>HKEY_LOCAL_MACHINE,System\CurrentControlSet\Control\TimeZoneInformation,Bias,StdBias
If>%ActiveBias%=%StdBias%,notdst
MessageModal>%ActiveBias% %StdBias% PC Time Is DST
Goto>theend
Label>notdst
MessageModal>%ActiveBias% %StdBias% PC Time Is Not DST
Label>theend

Update: It works

RegistryReadKey>HKEY_LOCAL_MACHINE,System\CurrentControlSet\Control\TimeZoneInformation,ActiveTimeBias,ActiveBias
RegistryReadKey>HKEY_LOCAL_MACHINE,System\CurrentControlSet\Control\TimeZoneInformation,Bias,StdBias
If>%ActiveBias%=%StdBias%,notdst
MessageModal>%ActiveBias% %StdBias% PC Time Is DST
Goto>theend
Label>notdst
MessageModal>%ActiveBias% %StdBias% PC Time Is Not DST
Label>theend