ScenEdit_CurrentTime doesn't match Zulu time?

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
Whicker
Posts: 665
Joined: Tue Jun 19, 2018 9:54 pm

ScenEdit_CurrentTime doesn't match Zulu time?

Post by Whicker »

local TimeVar = ScenEdit_CurrentTime();
print (os.date("%A %B %d %H%M ",TimeVar)); -- same result if I do just %c

When I do this in the console it is returning a different time - the game is telling me it is 2159 Z or 1659 local, but the script returns 1459. the date is correct, just the hour doesn't match anything.

I tried this in a couple tutorials and got more or less the same thing - the script doesn't match the zulu time.

Why is this? the docs say "The UTC Unix timestamp of the current time in-game."

Also, what I would prefer is the time relative to a timezone, but I can't figure that out other than adding seconds to the raw epoch number to change the hours to what I want it to be - is there an easier way? that actually seems pretty easy though.
Whicker
Posts: 665
Joined: Tue Jun 19, 2018 9:54 pm

RE: ScenEdit_CurrentTime doesn't match Zulu time?

Post by Whicker »

Interesting - it was always off in the console, but I stuck it in the game and it is giving me local time to florida which is where the map is zoomed in to - and what I wanted.

it is not giving me UTC/Zulu.
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: ScenEdit_CurrentTime doesn't match Zulu time?

Post by Rory Noonan »

Try this:
local TimeVar = ScenEdit_CurrentTime()
print (os.date("!%A %B %d %H%M ",TimeVar))

Also the semicolons are not necessary
Image
Whicker
Posts: 665
Joined: Tue Jun 19, 2018 9:54 pm

RE: ScenEdit_CurrentTime doesn't match Zulu time?

Post by Whicker »

Ah - I saw the ! in another post saying it was for UTC, but forgot and was looking for at the docs where it isn't mentioned.

Turned out my second post above was incorrect, I had an orphan variable that was screwing it up - so it was still off by 2 hours. I am adding 7200 on to the epoch time and it is returning what I want now.
Post Reply

Return to “Lua Legion”