Skip to content
Permalink
Browse files

Add time zone to /time command output.

To facilitate this, added the GetTimeZoneName() function to modDateTime.

"The current time on this computer is 8:53:04 PM on 04-19-2016 (Eastern
Standard Time)."
  • Loading branch information...
Davnit committed Apr 20, 2016
1 parent 3e642cd commit 694803199f71fd2d068fe96b5102222ac0a4d3fe
Showing with 31 additions and 1 deletion.
  1. +1 −1 trunk/modCommandsInfo.bas
  2. +30 −0 trunk/modDateTime.bas
@@ -624,7 +624,7 @@ Public Sub OnTagBans(Command As clsCommandObj)
End Sub

Public Sub OnTime(Command As clsCommandObj)
Command.Respond "The current time on this computer is " & Time & " on " & Format(Date, "MM-dd-yyyy") & "."
Command.Respond StringFormat("The current time on this computer is {0} on {1} ({2}).", Time, Format(Date, "MM-dd-yyyy"), GetTimeZoneName())
End Sub

Public Sub OnTrigger(Command As clsCommandObj)
@@ -127,3 +127,33 @@ Public Function GetTimeZoneBias() As Long
End Select
End Function

Public Function GetTimeZoneName() As String
Dim TZinfo As TIME_ZONE_INFORMATION ' holds time zone info
Dim lngL As Long ' time zone info result
Dim i As Long ' counter
Dim b As Integer ' a single character from the time zone name
Dim str As String ' return string

' Get the time zone info
lngL = GetTimeZoneInformation(TZinfo)

' Convert the name
For i = 0 To 31

' Standard or daylight savings?
If lngL = TIME_ZONE_ID_DAYLIGHT Then
b = TZinfo.DaylightName(i)
Else
b = TZinfo.StandardName(i)
End If

' Name is null-padded
If b = 0 Then
Exit For
Else
str = str & Chr(b)
End If
Next

GetTimeZoneName = str
End Function

0 comments on commit 6948031

Please sign in to comment.
You can’t perform that action at this time.