;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       ActiveTimeZone() 
;; 
;;ACTION         Retrieves the Active Timezone or Active Timezone Bias  
;; 
;;AUTHOR         Christopher Shilt 
;; 
;;VERSION        1.0 - 2005/08/15 
;; 
;;SYNTAX         ActiveTimeZone([BIAS]) 
;; 
;;PARAMETERS     BIAS - OPTIONAL 
;;               - Specifies whether to return the active timezone bias.  
;;                BIAS = 0 (Active Timezone)  
;;                BIAS = 1 (Active Timezone Bias) 
;; 
;;REMARKS        This function returns the time difference from Greenwich Mean Time 
;;               (GMT) adjusted for Daylight Savings Time. For example, if you are 
;;               in the Eastern Time Zone (GMT-05:00) and Daylight Savings is in 
;;               effect the function will return "-4".  
;; 
;;               When returning the Active Timezone Bias, the value is the current 
;;               time difference from Greenwich Mean Time (GMT) in minutes and is the 
;;               difference for GMT. For example, if you are in the Eastern Time Zone 
;;               with Daylight Savings in effect, the difference in minutes is 240.  
;; 
;;RETURNS        The current active timezone, or the current active timezone bias.  
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K3, W2K8, W2K12 
;; 
;;EXAMPLES       ; ; == Return the Active Timezone =================================   
;;               $Timezone = fnActiveTimeZone()  
;;   
;;               ; == Return the Active Timezone Bias ============================   
;;               $TimzoneBias = fnActiveTimeZone(1)  
; 
Function ActiveTimeZone(Optional $_Bias)
 
  $ActiveTimeZone = Val(ReadValue('HKLM\System\CurrentControlSet\Control\TimeZoneInformation\','ActiveTimeBias'))
  If @ERROR Exit @ERROR EndIf
 
  $ActiveTimeZone = IIf($_Bias, $ActiveTimeZone, $ActiveTimeZone / 60 * -1)
 
  Exit 0
 
EndFunction