[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua how to get current and previous day
- From: Tony Finch <dot@...>
- Date: Tue, 14 Sep 2010 15:36:18 +0100
On Tue, 14 Sep 2010, Natanael Copa wrote:
> On Tue, Sep 14, 2010 at 3:10 PM, Ted Unangst <email@example.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.
f.anthony.n.finch <firstname.lastname@example.org> 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.