lua-users home
lua-l archive

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


On Tue, Sep 14, 2010 at 4:36 PM, Tony Finch <dot@dotat.at> wrote:
> 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.

You are of course right about this. The thing i got bitten by once was
daylight saving when time functions returned local time instead of
UTC. But that was PHP on windows.

Its good to be aware of that a day is not always 86400 seconds though.

-- 
Natanael Copa