lua-users home
lua-l archive

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

> This assumes that the time zone bias now is equal to what it was at the
> epoch time.
> Secondly, this assumes further that the bias does not change between the
> two calls to Which in my time zone could have been violated
> about three days ago.

As far as I understand, the libraries use the current time zone for
its computations, so the time zone bias at the epoch time does not
seem to be relevant here. Anyway, we can change that line to use
the current time:

-TZ = os.difftime(os.time("*t", 0)), os.time("!*t", 0)))
+t = os.time()
+TZ = os.difftime(os.time("*t", t)), os.time("!*t", t)))

The fact that the bias may change between the two calls to
also seems to be irrelevant, because only one of the calls use the

What may be a problem is a change in time zone between the computation
of "TZ" and its use (in a call to 'utime'). If that is a real concern,
'utime' can recompute TZ after calling os.time; if it changed, redo
using this new value.  (It assumes that the time zone will not change
twice during that computation; that seems a safe assumption.)

-- Roberto