RTEMS | Cannot obtain dates later than 2100 (!339)
Gedare Bloom (@gedare)
gitlab at rtems.org
Tue Feb 11 03:53:36 UTC 2025
Gedare Bloom started a new discussion on cpukit/rtems/src/clockgettod.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_119623
> - year = ( days / RTEMS_DAYS_PER_YEAR ) + RTEMS_YEAR_BASE;
> -
> - /* Determine the number of leap years. */
> - leap_years = _Leap_years_between( RTEMS_YEAR_BASE, year );
> -
> - /* Adjust the remaining number of days based on the leap years. */
> - year_days = ( days - leap_years ) % RTEMS_DAYS_PER_YEAR;
> -
> - /* Adjust the year and days in the year if in the leap year overflow. */
> - if ( leap_years > ( days % RTEMS_DAYS_PER_YEAR ) ) {
> - year -= 1;
> - if ( _Leap_year( year ) ) {
> - year_days += 1;
> - }
> - }
> + current_time_tm = gmtime_r( &now.tv_sec, &buf );
@joel it looks like newlib's `gmtime_r` never errors out, so this is ok. But should we add an assert here? `_Assert( current_time_tm != NULL )`
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_119623
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250211/46ea147d/attachment-0001.htm>
More information about the bugs
mailing list