Keep It Simple, Stupid | |
PerlMonks |
Re: Arithmetic bug within Time:Piece?by CountZero (Bishop) |
on Oct 02, 2015 at 20:58 UTC ( [id://1143682]=note: print w/replies, xml ) | Need Help?? |
The constant ONE_MONTH is defined as 2_629_744 seconds, which is the number of seconds in one year divided by twelve and hence is some kind of "average" month, totally useless for your purpose. The same problem happens with ONE_YEAR which is 31_556_930 seconds or the number of seconds in 365.24225 days The fact that your year calculation was off by about one quarter of a day was a dead give-away. CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James My blog: Imperial Deltronics
In Section
Seekers of Perl Wisdom
|
|