RTEMS | score: Fix TOD_LATEST_YEAR and watchdog overflow beyond 2400 (!1484)
Sebastian Huber (@sebhub)
gitlab at rtems.org
Tue Sep 22 23:31:36 UTC 2026
Sebastian Huber commented on a discussion: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1484#note_159809
The `uint64_t Watchdog_Control::expire` member represents a time point for all three clocks: ticks, CLOCK_REALTIME, CLOCK_MONOTONIC. The POSIX clocks use 34 bits for the seconds part and 30 bits for the nanoseconds:
```c
/**
* @brief The maximum watchdog ticks value for the far future.
*/
#define WATCHDOG_MAXIMUM_TICKS UINT64_MAX
#define WATCHDOG_NANOSECONDS_PER_SECOND 1000000000
/**
* @brief The bits necessary to store 1000000000
* (= WATCHDOG_NANOSECONDS_PER_SECOND) nanoseconds.
*
* The expiration time is an unsigned 64-bit integer. To store nanoseconds
* timeouts we use 30 bits (2**30 == 1073741824) for the nanoseconds and 34
* bits for the seconds since UNIX Epoch. This leads to a year 2514 problem.
*/
#define WATCHDOG_BITS_FOR_1E9_NANOSECONDS 30
/**
* @brief The maximum number of seconds representable in the nanoseconds
* watchdog format.
*
* We have 2**34 bits for the seconds part.
*/
#define WATCHDOG_MAX_SECONDS 0x3ffffffff
```
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1484#note_159809
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/49/sent_notifications/5-brrv1yrav0fv8em41ztbn66jx-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260922/c6788bd2/attachment-0001.htm>
More information about the bugs
mailing list