lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Monday, August 5, 2013, Daurnimator wrote:
Also possibly relevant, I was working last week on a timezone library for lua.
https://github.com/daurnimator/luatz

The relevant function would probably be `timetable.new_from_timestamp`

On 5 August 2013 19:56, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> You can trivially implement a POSIX-portable timegm()
>
> By change, I've just written a version of gmtime in Lua:
>         http://stackoverflow.com/questions/17872997/how-do-i-convert-seconds-since-epoch-to-current-date-and-time/17889530#17889530
>
> Perhaps it's useful.
>


Later, when I need to receive time from external sources and interpret it into local time, then yes, very much so. 

The challenge in front of me was one so basic, I'm sure that you thought I was asking something more sophisticated. I was only trying to be sure that is.time() wasn't going to violate "the next increment will always be os.time() + 1, even if stupid daylight savings time comes around." 

It wasn't until considering this basic problem that I realized I'm in for a larger one, when I get to external input, which is the answer provided by your solution. 

-Andre