UTC

You can talk about anything related to LB Booster here, not covered in another category
User avatar
JackKelly
Posts: 63
Joined: Fri Apr 06, 2018 2:38 am
Location: Rome NY, USA

UTC

Post by JackKelly »

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.
guest
Site Admin
Posts: 193
Joined: Tue Apr 03, 2018 1:34 pm

Re: UTC

Post by guest »

JackKelly wrote: Sat Nov 04, 2023 5:07 pm 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.
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
User avatar
JackKelly
Posts: 63
Joined: Fri Apr 06, 2018 2:38 am
Location: Rome NY, USA

Re: UTC

Post by JackKelly »

How is that struc used? The examples in GetSystemTime are in C++
User avatar
JackKelly
Posts: 63
Joined: Fri Apr 06, 2018 2:38 am
Location: Rome NY, USA

Re: UTC

Post by JackKelly »

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