[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua32: Any easy fix for 2038 problem of os.time?
- From: Flyer31 Test <flyer31@...>
- Date: Tue, 10 Aug 2021 21:22:52 +0200
PS: BTW I now found a very nice and short implementation of the two
basic functions "gmtime" and "mktime" in Wiki - please have a look at
the German page for "Unix time" ("Unixzeit")... this is nice code in
plain C with less than 50 lines - this of course uses long long
variables... but it is quite straight forward to change this code to
32bit with some shifted "8sec resolution" or so ... of courrse then
needs careful testing, and I do not have the ambition that it should
run also for the crazy year "gregorian switch year" 1582 or for the
Julian calender used before... .
On Tue, Aug 10, 2021 at 8:48 PM Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>
> > For Lua32, as well as for Linux32, this 2038 problem of os.time is really
> > quite nerving.
> >
> > [...]
> >
> > In my own "practical approach" I would now not count the number of seconds,
> > but the number of 8 seconds - [...]
>
> What version of Lua are you talking about? In 5.4, it should be easy
> to change how you convert the "internal" representation of time (time_t)
> and the "external" representation of time (lua_Integer), so a single
> shift would solve your problems for Lua32. For Linux32, any solution
> seems to be outside the Lua realm.
>
> -- Roberto