I forgot that the birthday year doesn't matter, just the current year +- 1 matters. I was thinking more generally when you asked about
(localtime)[7], not how it applied here. While the way your calculate leap years is wrong in a general sense, it is a correct simplification for the expect inputs. A comment about this wouldn't hurt. ++.
I'd like to see an example of off by a day with certain combinations of current time, current date and current timezones.
Sure, tell me on which date the time spring forwards or falls back this year Note that I only *think* your program will return an incorrect answer for some time periods due to DST, as I have said earlier. I'm not sure what the circumstances are that causes the problem, which is why I use timegm+gmtime to completely avoid the issue.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.