I'm trying to make a lua script that checks the FSX time against the current UTC time and then sets the FSX time to the real UTC time if it isn't already there. So, for example, if I load the default flight and set the time to "dusk" and that UTC time is not accurate, it will update the time to the current UTC time.
This is the first time I have ever touched LUA, so I don't know what I am doing. The only programming I have done is in PHP. I came up with this after some googling, but it isn't working, so I am trying to figure out what I am doing wrong. Any help is appreciated!
-- FSX UTC Time Synch
-- Novbember 2015
-- V 1.0
-- ## Sets FSX Time to UTC ###############
while 1 do
simHour = ipc.readUB("023B")
simMinute = ipc.readUB("023c")
Hour = os.date("!%H")
Minute = os.date("!%M")
if simHour ~= Hour
then
ipc.writeUB("023B", Hour)
end
if simMinute ~= Minute
then
ipc.writeUB("023c", Minute)
end
ipc.sleep(120)
end