lua-users home
lua-l archive

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


On Tue, 14 Sep 2010, Natanael Copa wrote:
> On Tue, Sep 14, 2010 at 3:10 PM, Ted Unangst <ted.unangst@gmail.com> wrote:
> >
> > Option 1:
> > now = os.time()
> > yesterday = now - 3600*24
> > print(os.date("...", yesterday))
>
> This might give you weird bugs once in a while as it wrongly assumes
> that a day is always 3600 * 24 hours. You need take leap years and
> leap seconds in consideration.

Leap years never affect the length of any days. POSIX time gives every day
86400 seconds regardless of leap seconds.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
HUMBER THAMES DOVER WIGHT PORTLAND: NORTH BACKING WEST OR NORTHWEST, 5 TO 7,
DECREASING 4 OR 5, OCCASIONALLY 6 LATER IN HUMBER AND THAMES. MODERATE OR
ROUGH. RAIN THEN FAIR. GOOD.