[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Back and forth UTC dates
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 28 Mar 2017 15:21:52 -0300
> > 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.
What is wrong with the following implementation?
TZ = os.difftime(os.time(os.date("*t", 0)), os.time(os.date("!*t", 0)))
function utime (t)
t.sec = t.sec + TZ
return os.time(t)
end
It uses only ISO C stuff...
-- Roberto