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

Kinsey Moore (@opticron) gitlab at rtems.org
Thu Jan 30 15:19:18 UTC 2025




Kinsey Moore commented on a discussion on cpukit/rtems/src/clockgettod.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_118507

 > +  struct tm buf;
 > +  time_t current_time = time(NULL);
 > +  struct tm *current_time_tm; 
 > +  current_time_tm = gmtime_r( &current_time, &buf );
 >  
 > -  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->year   = 1900 + current_time_tm->tm_year;
 > +  time_of_day->month  = 1 + current_time_tm->tm_mon;
 > +  time_of_day->day    = current_time_tm->tm_mday;
 > +  time_of_day->hour   = current_time_tm->tm_hour;
 > +  time_of_day->minute = current_time_tm->tm_min;
 >    time_of_day->second = time_of_day->minute % RTEMS_SECS_PER_MINUTE;

I don't see seconds filled in anywhere except this line for this structure. Where else is it filled in?

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_118507
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/20250130/9a727305/attachment-0001.htm>


More information about the bugs mailing list