lua-users home
lua-l archive

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


> > 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