musurca
Posts: 128
Joined: 7/16/2020 Status: offline
|
quote:
I get the same results as michaelm when changing to German, or Korean,etc. Same here, actually -- I'm having a hard time reproducing it, but the person reporting it sent me a .save file where this had occurred, so thought it was worth mentioning. quote:
however in-game before feeding it to SetTime(), based on using os.date, MAKE SURE if you want UTC and only UTC you prefix your format string with !, it tell Lua to ignore system locality\region settings. Ah-ha! Thanks, I wasn't aware of that syntax. I've gone ahead and switched to that. Fingers crossed that this will solve the issue. If anyone else is experiencing this with my use case-- resetting the scenario time to the start time--this is the code I'm using, adapted from KnightHawk75's suggestion:
function StartTimeToUTC()
local date_str = os.date("!%m.%d.%Y", VP_GetScenario().StartTimeNum)
local time_str = os.date("!%H.%M.%S", VP_GetScenario().StartTimeNum)
return {Date=date_str, Time=time_str}
end
ScenEdit_SetTime(StartTimeToUTC())
|