avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #44327] eu_dst() is broken


From: Mark Moore
Subject: [avr-libc-dev] [bug #44327] eu_dst() is broken
Date: Fri, 11 Oct 2019 05:21:15 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/75.0.3770.90 Chrome/75.0.3770.90 Safari/537.36

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]