Follow-up Comment #1, bug #44327 (project avr-libc):

The current algorithm misfires if the month starts on a Thursday, in which
case d is calculated to be 31, when it should have been 24. 
Adding the following after line 91 fixes it:

if(d==31) d=24;



it does impact the elegance of the algorithm somewhat, and probably
performance, but only on months that start on a thursday ;)

I have attached a python script that runs the algorithm 31*7 times, simulating
each day of a month (0-30) being each day of the week (0-6), the script prints
out an error if any calculation doesn't match the hard-coded truth table.

~Mark

(file #47647)
    _______________________________________________________

Additional Item Attachment:

File name: dstCheck.py                    Size:1 KB
    <https://savannah.nongnu.org/file/dstCheck.py?file_id=47647>



    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?44327>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to