You know, it would seriously make my day if you guys added something like a utc_now()
function that could be used as an alternative to the horrible builtin lua time apis.
All I want is a simple function for getting a utc timestamp, with no buggering about with timezones. Maybe getting better than 1-second precision would be nice too. Maybe you could slip such a function into the sys
module?
Look at how difficult this is in pure lua:
http://lua.2524044.n2.nabble.com/os-time-and-timezones-td7461931.html
Honestly, the implementations that I’ve found are complex enough that I can’t even convince myself that they work in all cases…
And before anyone asks, I need absolute time, not just relative time values that can be used to calculate deltas (such as socket.gettime()
).
Ultimately, I may decide that having a trusted timestamp is necessary, in which case I might have to do a request to an ntp server or something, though it would be nice to not rely on having an internet connection.