Get UTC time in LUA script

Hello everyone!

Simple question:
I want to output a (possibly custom) NMEA sentence out a serial port.
I opted to use a Lua script to do that.

I need to post the UTC time, but can’t find any corresponding binding for that.
Is it missing or it’s me that I’m missing something?


I think you should be able to calculate UTC time from the GPS week and week ms. The bindings are:


We should probably just add a binding for UTC directly…

Yeah, I saw those bindings but felt a bit awkward using them.

While we’re at this, is there any way to test Lua scripts in the Ubuntu SITL toolchain?

I’ve placed a .lua file under ~/ardupilot[-lua] as per LUA scripts within SITL simulations? but that didn’t help.

Found the correct path.
After enabling the SCR_ENABLE parameter once, place the script at