Changeset a44b58c in mainline for uspace/drv/time/cmos-rtc/cmos-rtc.c


Ignore:
Timestamp:
2012-04-18T20:31:12Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e341110
Parents:
bfc5577a
Message:

rtc: improved tm structure sanity check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/time/cmos-rtc/cmos-rtc.c

    rbfc5577a ra44b58c  
    402402        }
    403403
    404         if (rtc_register_read(rtc, RTC_YEAR) < 100) {
    405                 /* The RTC epoch is year 2000 */
     404        if (epoch == 2000) {
     405                /* The RTC epoch is year 2000  but the tm_year
     406                 * field counts years since 1900.
     407                 */
    406408                t->tm_year -= 100;
    407409        }
     
    467469        else if (epoch == 2000 && t->tm_year < 100)
    468470                return EINVAL;
    469         else if (t->tm_year < 0)
     471        else if (t->tm_year < 0 || t->tm_year > 199)
    470472                return EINVAL;
    471473
Note: See TracChangeset for help on using the changeset viewer.