After all that I found a bug in my code that didn't update the Time Zone field properly or the offset on a Daylight Savings change. This should take care of it.
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
$AppTitle = "NTP Client"
$AppVersion = "1.0"
$AppTitleVersion = $AppTitle & " v" & $AppVersion
#Region ### START Koda GUI section ###
$frmMain = GUICreate($AppTitleVersion, 498, 271, 239, 155)
$txtNTPServer = GUICtrlCreateInput("pool.ntp.org", 72, 8, 417, 21)
$Label1 = GUICtrlCreateLabel("NTP Server:", 8, 10, 63, 17)
$cmdQuery = GUICtrlCreateButton("Query", 416, 240, 75, 25, $WS_GROUP)
$grpNTPServer = GUICtrlCreateGroup("NTP Server", 8, 32, 481, 73)
$Label2 = GUICtrlCreateLabel("NTP Server UTC:", 48, 52, 88, 17)
$txtNTPServerUTC = GUICtrlCreateInput("", 136, 48, 345, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$txtNTPServerLocalTime = GUICtrlCreateInput("", 136, 72, 345, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Label5 = GUICtrlCreateLabel("NTP Server Local Time:", 18, 76, 118, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$grpLocal = GUICtrlCreateGroup("Local Computer", 8, 112, 481, 121)
$Label3 = GUICtrlCreateLabel("Time Zone:", 73, 134, 58, 17)
$Label4 = GUICtrlCreateLabel("Offset (hours):", 61, 154, 70, 17)
$Label6 = GUICtrlCreateLabel("UTC Time:", 76, 177, 55, 17)
$txtTimeZone = GUICtrlCreateInput("", 136, 128, 345, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$txtOffset = GUICtrlCreateInput("", 136, 152, 345, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$txtLocalUTCTime = GUICtrlCreateInput("", 136, 176, 345, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$txtLocalTime = GUICtrlCreateInput("", 136, 200, 345, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
$Label9 = GUICtrlCreateLabel("Local Time:", 72, 199, 59, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;**************************************************************************************************
;** Functions *************************************************************************************
;**************************************************************************************************
Func MakePacket($d)
Local $p=""
While $d
$p&=Chr(Dec(StringLeft($d,2)))
$d=StringTrimLeft($d,2)
WEnd
Return $p
EndFunc
Func UnsignedHexToDec($n)
$ones=StringRight($n,1)
$n=StringTrimRight($n,1)
Return dec($n)*16+dec($ones)
EndFunc
Func QueryNTP($ntpServer)
UDPStartup()
Dim $socket = UDPOpen(TCPNameToIP($ntpServer), 123)
If @error <> 0 Then
MsgBox(0,"","Can't open connection!")
Return 0
EndIf
$status = UDPSend($socket, MakePacket("1b0e01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"))
If $status = 0 Then
MsgBox(0, "ERROR", "Error while sending UDP message: " & @error)
Return 0
EndIf
$data=""
While $data=""
$data = UDPRecv($socket, 100)
sleep(100)
WEnd
UDPCloseSocket($socket)
UDPShutdown()
$unsignedHexValue=StringMid($data,83,8) ; Extract time from packet. Disregards the fractional second.
$value=UnsignedHexToDec($unsignedHexValue)
$TZinfo = _Date_Time_GetTimeZoneInformation()
;msgbox(4096, "", $TZinfo[0])
$UTC=_DateAdd("s",$value,"1900/01/01 00:00:00")
Switch $TZinfo[0]
Case 0 ;Daylight Savings not used in current time zone
$TZoffset = 0
$TimeZone = $TZinfo[2]
Case 1 ;Standard Time
$TZoffset = ($TZinfo[1]) * -1
$TimeZone = $TZinfo[2]
Case 2 ;Daylight Savings Time
$TZoffset = ($TZinfo[1] + $TZinfo[7]) * -1
$TimeZone = $TZinfo[5]
EndSwitch
GUICtrlSetData($txtNTPServerUTC, $UTC)
GUICtrlSetData($txtNTPServerLocalTime, _DateAdd("n",$TZoffset,$UTC))
GUICtrlSetData($txtTimeZone, $TimeZone)
GUICtrlSetData($txtOffset, $TZoffset / 60)
GUICtrlSetData($txtLocalUTCTime, _DateAdd("n",$TZoffset * -1,_NowCalc()))
GUICtrlSetData($txtLocalTime, _NowCalc())
EndFunc
Func CenterWindow($window_title)
$position = WinGetPos($window_title)
WinMove($window_title, "", (@desktopwidth / 2) - ($position[2] / 2), (@desktopheight / 2) - ($position[3] / 2))
EndFunc
CenterWindow($AppTitleVersion)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $cmdQuery
QueryNTP(GUICtrlRead($txtNTPServer))
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd