RTEMS | Cannot obtain dates later than 2100 (!339)

zack liang (@zakthertemsdev) gitlab at rtems.org
Sat Mar 22 18:16:23 UTC 2025




zack liang commented on a discussion on cpukit/rtems/src/clockgettod.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_121627

 > -    year -= 1;
 > -    if ( _Leap_year( year ) ) {
 > -      year_days += 1;
 > -    }
 > -  }
 > +  current_time_tm = gmtime_r( &now.tv_sec, &buf );
 > +  _Assert( current_time_tm != NULL );
 >  
 > -  time_of_day->year   = year;
 > -  time_of_day->month  = _Year_day_as_month( year, &year_days ) + 1;
 > -  time_of_day->day    = year_days + 1;
 > -  time_of_day->hour   = day_secs / RTEMS_SECS_PER_HOUR;
 > -  time_of_day->minute = day_secs % RTEMS_SECS_PER_HOUR;
 > -  time_of_day->second = time_of_day->minute % RTEMS_SECS_PER_MINUTE;
 > -  time_of_day->minute = time_of_day->minute / RTEMS_SECS_PER_MINUTE;
 > +  time_of_day->year   = 1900 + current_time_tm->tm_year;

@gedare  I don't think it is since it's mostly a constant defined in the old getclocktod implementation


`define RTEMS_YEAR_BASE       (1970UL)`

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_121627
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/20250322/95aa6afe/attachment-0001.htm>


More information about the bugs mailing list