No such thing as a small change | |
PerlMonks |
Re^4: Calculate Age, days to next and days from last for a given birthdayby ruzam (Curate) |
on Apr 29, 2006 at 05:03 UTC ( [id://546469]=note: print w/replies, xml ) | Need Help?? |
I thought the category 'fun stuff' was obvious.... I take great pride in my code (even if it's sometimes wrong). I also spent the better part of 1997 thru 1999 fixing broken mainframe date code for a living. If you want to compare a 30 year old 2 digit year problem to a 100 year old leap year problem I think there's a baby/bath-water comparison that could be made. For all you know, by 2100 the leap year rule may be changed into another exception just to prevent computer leap year problems from popping up! (if we're even using the same calendar system by then) The code I've written here specifically uses current date +/- 1 year. Without rewriting portions of it, it will never see 1900. You, me and everything we know and believe about computers will be long since dead and turned to dust before this code ever sees 2100. So the scenario of someone using this snippet untouched for either of those years is not even a probability. That's the beauty of the 2000 'exception'. The code as written (pending some revisions) will happily work with any birthdate of any year. You can use any number that Perl will accept for the birthdate year, it isn't even passed to a date function of any kind. There is no provision to provide any date other than the current date. To make such a modification would require more careful attention to leap years as you've suggested. It would also not be the code I wrote. The point of my writing it was to avoid using Date::Calc. If Date::Calc were a core module I might have considered it first but it's not. There are times when you can't just pick the module of your dreams and toss it into the script.
In Section
Code Catacombs
|
|