Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a44b58c in mainline


Ignore:
Timestamp:
2012-04-18T20:31:12Z (10 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
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.