lua-users home
lua-l archive

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


On Tue, Mar 28, 2017 at 5:50 PM, Luiz Henrique de Figueiredo
<> wrote:
>> The conclusion is that os.time expects a table in local time and not in utc.
>> A os.utime or similar would be quite useful.
> Like I said in stackoverflow, unfortunately, os.utime cannot be
> implemented within ISO C and POSIX.

>From what I've read in man mktime, and loslib.c and some related code
I could re-write the utc_time lua function ( which should probably be
caleed gmt_time ) I posted earlier in plain C using the types used by
loslib for os.time and probably test it for the full 0-2**31 range for
round-trip conversion with gmtime ( fmt_mktime(gmtime(x))==x for each
x in (time_t) 0L..MAX_INT or MAX_LONG) ( In linux, 32 and possibly 64
bits ).

Adjustments of wday / ydday would be more challenging, but could
possibly be done by just doing a gmtime back and tested too. If this
would be of any use to put a os.gmt_time variant I'll happily do it
and send them to you.

I assume macs are similar, and IIRC windows is too and could be
adapted, but I do not have access to any of them.

Francisco Olarte.