'_______________________________________________________________ 'DAYLIGHT SAVING TIME TEST - Written By Warwick Black 28/10/2005 'warwick.black@citect.com ' 'SUMMARY: 'This Function reads two registry settings, to determine 'whether the system clock is compensating for Daylight Saving Time. 'The code reads two registry entries, the 'ActveTimeBias' and the ''Bias' from the TimeZoneInformation section. 'The 'Normal' time bias is the usual time variation from GMT, whereas the ''ActiveTimeBias' is the variation actually being used. If they are not equal, 'then the system clock is adding compensation for Daylight Saving Time. 'USAGE: 'Call from a Button using: 'Civba 'CheckDaylight 'Or by a timed event etc. '_______________________________________________________________ Dim strFullPath 'Stores full registry key paths Dim stDefault Dim objReg Dim objSubKey, arrSubKeys Const strComputerName = "." 'This function enables the reading of registry entries Public Function WMIGetSetting (stRoot, stSection, stKey, stAppPath) On Error Goto HANDLE_ERR strFullPath = stAppPath & "\" & stSection Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputerName & "\root\default:StdRegProv") objReg.GetdwordValue stRoot, strFullPath, stKey, stDefault WMIGetSetting = stDefault 'Get string value of key Exit Function HANDLE_ERR: MsgBox Err.Description End Function 'This the function that is called to determine whether Daylight Saving Time is active or not Public Sub CheckDaylight() Dim ActiveTimeBias Dim Bias ActiveTimeBias = WMIGetSetting(&H80000002, "Timezoneinformation", "activetimebias","System\CurrentControlSet\Control") Bias = WMIGetSetting(&H80000002, "Timezoneinformation", "bias","System\CurrentControlSet\Control") If Bias <> ActiveTimeBias Then 'DAYLIGHT SAVING TIME msgbox "Daylight Savings!!!" 'ADD YOUR FLAG THAT YOU WISH TO SET/UNSET HERE Else 'NORMAL TIME msgbox "Normal Time" 'ADD YOUR FLAG THAT YOU WISH TO SET/UNSET HERE End If End Sub