RTEMS | Cannot obtain dates later than 2100 (!339)
Joel Sherrill (@joel)
gitlab at rtems.org
Sun Dec 1 17:07:02 UTC 2024
Merge request https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339 was reviewed by Joel Sherrill
--
Joel Sherrill started a new discussion on cpukit/rtems/src/clockgettod.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_115980
> * How many days and how many seconds in the day?
> - *
> + * timeval - time_t - tm - rttems tod
only one t in rtems_tod
--
Joel Sherrill started a new discussion on cpukit/rtems/src/clockgettod.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_115981
> + time_t current_time = time(NULL);
> + struct tm * current_time_tm;
> + current_time_tm = gmtime(¤t_time);
This should use gmtime_r()
--
Joel Sherrill started a new discussion on cpukit/rtems/src/clockgettod.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_115982
> - time_of_day->minute = day_secs % RTEMS_SECS_PER_HOUR;
> +
> + time_of_day->year = 1900+ current_time_tm->tm_year;
Spaces around +
--
Joel Sherrill started a new discussion on cpukit/rtems/src/clockgettod.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_115983
> +
> + time_of_day->year = 1900+ current_time_tm->tm_year;
> + time_of_day->month = 1+current_time_tm->tm_mon;
Spaces around +
--
Joel Sherrill commented: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339#note_115984
This only addresses the "get" side of the change. See clocktodvalidate.c for the error checks for > year 2100. I think in the set tod side, you want to use localtime_r() to convert struct tm (filled in using the Classic API TOD structure).
There should also be test changes. Please run all tests and see what broke.
I see references to 2100 in the c-user's guide in rtems-docs. Those will have to be addressed also.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/339
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/20241201/79576ccb/attachment-0001.htm>
More information about the bugs
mailing list