Does anyone have a routine to get the current UTC (Greenwich Mean Time, Zulu Time)?
I couldn't find anything with a search in the old or new forums.
UTC
Re: UTC
MSDN says to use GetSystemTime: "Retrieves the current system date and time in Coordinated Universal Time (UTC) format".
Google finds this Liberty BASIC definition of the structure (I've not tried it):
Code: Select all
Struct SYSTEMTIME, _'struct to hold date time info to interact with control
wYear As word, _
wMonth As word, _
wDayOfWeek As word, _ '0 = Sunday, 1 = Monday, etc.
wDay As word, _
wHour As word, _
wMinute As word, _
wSecond As word, _
wMilliseconds As word
Re: UTC
Chris Iverson gave me the answer.
struct SYSTEMTIME,_
Year as short, Month as short,_
DayOfWeek as short, Day as short,_
Hour as short, Minute as short, Second as short,_
Milliseconds as short
'GetSystemTime() retrives the current time as UTC.
CallDLL #kernel32, "GetSystemTime",_
SYSTEMTIME as struct,_
ret as void
print "Year - "; SYSTEMTIME.Year.struct
print "Month - "; SYSTEMTIME.Month.struct
print "Day - "; SYSTEMTIME.Day.struct
print "Day of Week - "; SYSTEMTIME.DayOfWeek.struct
print "Hour - "; SYSTEMTIME.Hour.struct
print "Minute - "; SYSTEMTIME.Minute.struct
print "Second - "; SYSTEMTIME.Second.struct
print "Millisecond - "; SYSTEMTIME.Milliseconds.struct
end
struct SYSTEMTIME,_
Year as short, Month as short,_
DayOfWeek as short, Day as short,_
Hour as short, Minute as short, Second as short,_
Milliseconds as short
'GetSystemTime() retrives the current time as UTC.
CallDLL #kernel32, "GetSystemTime",_
SYSTEMTIME as struct,_
ret as void
print "Year - "; SYSTEMTIME.Year.struct
print "Month - "; SYSTEMTIME.Month.struct
print "Day - "; SYSTEMTIME.Day.struct
print "Day of Week - "; SYSTEMTIME.DayOfWeek.struct
print "Hour - "; SYSTEMTIME.Hour.struct
print "Minute - "; SYSTEMTIME.Minute.struct
print "Second - "; SYSTEMTIME.Second.struct
print "Millisecond - "; SYSTEMTIME.Milliseconds.struct
end