Use #define RTC_BASE_YEAR versus 1980U in rtcConvertDateTimeToStructTm(...)

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13149 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
cinsights 2019-10-31 11:34:43 +00:00
parent 9d34ecb190
commit ce1f17e715
1 changed files with 2 additions and 2 deletions

View File

@ -222,7 +222,7 @@ void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec,
uint32_t *tv_msec) {
int sec;
timp->tm_year = (int)timespec->year + (1980 - 1900);
timp->tm_year = (int)timespec->year + (RTC_BASE_YEAR - 1900);
timp->tm_mon = (int)timespec->month - 1;
timp->tm_mday = (int)timespec->day;
timp->tm_isdst = (int)timespec->dstflag;
@ -253,7 +253,7 @@ void rtcConvertStructTmToDateTime(const struct tm *timp,
RTCDateTime *timespec) {
/*lint -save -e9034 [10.4] Verified assignments to bit fields.*/
timespec->year = (uint32_t)timp->tm_year - (1980U - 1900U);
timespec->year = (uint32_t)timp->tm_year - (RTC_BASE_YEAR - 1900U);
timespec->month = (uint32_t)timp->tm_mon + 1U;
timespec->day = (uint32_t)timp->tm_mday;
timespec->dayofweek = (uint32_t)timp->tm_wday + 1U;