Current Lua downloadable firmware will be posted here

User avatar
By cwilt
#40325 I have a custom build which includes sntp and rtctime modules. Now I can set time based on the return for NTP server.

For the life of me I am unable to find any time functions. Anyone else playing with these functions find a way to display time and date?
User avatar
By devsaurus
#40436 I use the following simple code to output time:
Code: Select allfunction hr_min_sec(stamp)
    return stamp % 86400 / 3600, stamp % 3600 / 60, stamp % 60
end

function show_time()
    local stamp
    local tz = 2

    stamp = rtctime.get() - 1104494400 - 1104494400 + tz*3600
    return(string.format("%02u:%02u:%02u", hr_min_sec(stamp)))
end

Displaying the date would need similar arithmetic but I never did it myself.
User avatar
By cwilt
#40462 Thanks.

I had started writing my own functions to handle date and time. Your method is very simple. I like it.

Wonder how the date would work...