sunshine@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 1 month agoI'm new to using Ruby and this tickled me pinklemmy.mlimagemessage-square81linkfedilinkarrow-up1275arrow-down17cross-posted to: programmer_humor@programming.dev
arrow-up1268arrow-down1imageI'm new to using Ruby and this tickled me pinklemmy.mlsunshine@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 1 month agomessage-square81linkfedilinkcross-posted to: programmer_humor@programming.dev
minus-squarecomfy@lemmy.mllinkfedilinkarrow-up2·1 month agoThat sounds serious, can you give some example values we can test?
minus-squaremrgoosmoos@lemmy.calinkfedilinkEnglisharrow-up12·1 month agolook I’m not trying to be a dick or anything, but do you not know about leap years and which years they are?
minus-squareKazumara@discuss.tchncs.delinkfedilinkarrow-up5·edit-21 month agoLeap years are each fourth year, except each hundredth year, except each thousandth fourhundredth year. 1896 leap year 1900 not leap year 1904 leap year … 1996 leap year 2000 leap year 2004 leap year … 2096 leap year 2100 not leap year 2104 leap year Then you just arrange the 10 year window in different positions to overlap 1 to 3 leap years to reveal the three outcomes of the bug. - / - - - / - - - / - - / - - - / - - - - - 0 - - - / - - - - is a normal year, / is a leap year, 0 is an exceptional non-leap year.
minus-squarecomfy@lemmy.mllinkfedilinkarrow-up1·edit-21 month agoedit: just realized it was the python and not ruby example, I was very tired and distracted when I was reading this thread.
minus-squareKazumara@discuss.tchncs.delinkfedilinkarrow-up10·1 month agoSure, here’s one example for each case: 1 day off: 3650 days before 1907-01-01 is 1897-01-02 2 days off: 3650 days before 2027-01-01 is 2017-01-03 3 days off: 3650 days before 2025-01-01 is 2015-01-04
minus-squaregonzo-rand19@moist.catsweat.comlinkfedilinkarrow-up4·1 month ago29 February 2028, 29 February 2032, 29 February 2036…
That sounds serious, can you give some example values we can test?
look I’m not trying to be a dick or anything, but do you not know about leap years and which years they are?
Yes, and I have no idea…
Leap years are each fourth year, except each hundredth year, except each thousandth fourhundredth year.
1896 leap year
1900 not leap year
1904 leap year
…
1996 leap year
2000 leap year
2004 leap year
…
2096 leap year
2100 not leap year
2104 leap year
Then you just arrange the 10 year window in different positions to overlap 1 to 3 leap years to reveal the three outcomes of the bug.
- / - - - / - - - /
- - / - - - / - - -
- - 0 - - - / - - -
- is a normal year, / is a leap year, 0 is an exceptional non-leap year.
edit: just realized it was the python and not ruby example, I was very tired and distracted when I was reading this thread.
Sure, here’s one example for each case:
1 day off: 3650 days before 1907-01-01 is 1897-01-02
2 days off: 3650 days before 2027-01-01 is 2017-01-03
3 days off: 3650 days before 2025-01-01 is 2015-01-04
29 February 2028, 29 February 2032, 29 February 2036…