[Phoenix-pm] WTF article regarding perl
vote.zaphod.beeblebrox at gmail.com
Fri Sep 21 18:00:32 PDT 2007
Hilarious. Unsurprisingly, it's borken. Look at the if statement for
when the second is 41 or higher, the minute is 59, the hour is 23, and
the month is 12. Regardless of what the day is, the month and day will
be set to 1 and the year will be incremented. In the test program I
wrote, here's what happens:
2004-11-29 23:59:55 2004-11-30 00:00:14 2004-11-30 00:00:14
2004-11-30 23:59:55 2004-12-01 00:00:14 2004-12-01 00:00:14
2004-12-01 23:59:55 2004-12-02 00:00:14 2005-01-01 00:00:14
The first one is the input date I generate in the script (11:55 PM for
each day in my test range), the second one is the result of doing
things the simple way ($time + 19), and the third is using the
function I made out of the worsethanfailure code. Notice in the third
one that it goes from 2004-12-01 to 2005-01-01 when 19 seconds get
Also, no attempt is made at getting it to work past 2015, and 4 is
added to the hours, presumably to get it in the correct time zone.
Nothing is done, though, to compensate for when adding 4 brings the
hour above 23. I removed the adding of 4 to make the date rollover
easier to test.
Code is here: http://pastebin.com/f6410b357
Thanks for posting the link.
On 9/21/07, Benjamin Trussell <benjamin.trussell at asu.edu> wrote:
> "All For 19 Seconds"
> Phoenix-pm mailing list
> Phoenix-pm at pm.org
ben at benatkin.com
More information about the Phoenix-pm