From fed41793686af53ad84c2d0bdf0a0cde3b479c60 Mon Sep 17 00:00:00 2001 From: Simon Hancock Date: Tue, 18 Jun 2024 10:51:52 +0100 Subject: [PATCH] WLua: Handle LUA error with %Z date format on Windows --- generator/mavgen_wlua.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generator/mavgen_wlua.py b/generator/mavgen_wlua.py index 6ccbdbb60..afd3d4a10 100644 --- a/generator/mavgen_wlua.py +++ b/generator/mavgen_wlua.py @@ -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 ""