Skip to content

Commit

Permalink
WLua: Handle LUA error with %Z date format on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
shancock884 authored and peterbarker committed Jun 19, 2024
1 parent 5d0496a commit 27eefbe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion generator/mavgen_wlua.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def generate_preamble(outf):
d = os.date("%Y-%m-%d %H:%M:%S",value:tonumber() / 1000000.0)
us = value % 1000000
us = string.format("%06d",us:tonumber())
tz = os.date(" %Z",value:tonumber() / 1000000.0)
ok, tz = pcall(os.date," %Z",value:tonumber() / 1000000.0)
if not ok then
tz = os.date(" %z",value:tonumber() / 1000000.0)
end
return " (" .. d .. "." .. us .. tz .. ")"
elseif value < 1000000 then
return ""
Expand Down

0 comments on commit 27eefbe

Please sign in to comment.