Opened on 06/04/09 at 14:54:40
Closed on 12/05/13 at 15:58:11
#1422 closed defect (fixed)
TOD_Validate incorrect time processing
Reported by: | Nickolay Semyonov-Kolchin | Owned by: | Joel Sherrill |
---|---|---|---|
Priority: | normal | Milestone: | 4.10 |
Component: | score | Version: | 4.10 |
Severity: | minor | Keywords: | |
Cc: | sebastian.huber@…, fjdpedrosa@…, gedare@… | Blocked By: | |
Blocking: |
Description
Our partners found two minor bugs in _TOD_Validate function:
- Leap year calculation is incorrect:
if(the_tod->year % 4 == 0)
is not enough. Correct way is:
if(
((the_tod->year % 4) == 0 && (the_tod->year % 100 != 0)) (the_tod->year % 400 == 0))
Reference: http://en.wikipedia.org/wiki/Leap_year
- The maximum possible year is 2038. Setting year to bigger value will
produce wrong result in current 32-bit RTEMS. (I never heard about RTEMS running on 64-bit platforms, though).
Patch that fix both problems attached.
Attachments (3)
Change History (7)
Changed on 06/04/09 at 14:54:40 by Nickolay Semyonov-Kolchin
comment:1 Changed on 11/10/09 at 17:07:57 by Filipe Pedrosa
Cc: | Filipe Pedrosa added |
---|
Changed on 12/05/13 at 12:00:46 by Chirayu Desai
Attachment: | 0001-Fix-leap-year-calculation.patch added |
---|
Fix only the leap year calcuation.
comment:2 Changed on 12/05/13 at 13:45:41 by Gedare Bloom
Cc: | Gedare Bloom added |
---|
comment:3 Changed on 12/05/13 at 13:51:53 by Sebastian Huber
Cc: | Sebastian Huber added |
---|
Changed on 12/05/13 at 15:52:56 by Chirayu Desai
Attachment: | 0001-sptest-sp2038-Add-a-test-for-leap-year.patch added |
---|
Testcase
comment:4 Changed on 12/05/13 at 15:58:11 by Gedare Bloom
Resolution: | → fixed |
---|---|
Status: | new → closed |
I committed the leap year test and fix. TI think the 2038 problem is addressed elsewhere perhaps. If not a new PR can be filed.
Note: See
TracTickets for help on using
tickets.
correct leap year calculation,