Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mavgen WLua: Pass unix time as integer to os.date #997

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shancock884
Copy link
Contributor

After updating Wireshark to v4.4.2 (Windows), I noticed that the SYSTEM_TIME message was showing an LUA error:

Lua Error: ardupilotmega.lua:21: bad argument #2 to 'date' (number has no integer representation)

The issue appears to be that the os.date function no longer accepts a floating point input. This is fixed by applying math.floor to the 'seconds' part of the timestamp before calling os.date. The microseconds part was already being appended to the output string separately.
As a side-note, this also avoids potentially calculating "value:tonumber() / 1000000.0" three times.

Output tested, and now working like so:

MAVLink Protocol (22)
    Payload: SYSTEM_TIME (2)
        time_unix_usec (uint64_t) [us]: 1733755765960647 (2024-12-09 14:49:25.960647 GMT Standard Time)
        time_boot_ms (uint32_t) [ms]: 7325
    Message CRC: 0xa932

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant