RTEMS | Specify limits of CLOCK_MONOTONIC (uptime) (#5538)

Sebastian Huber (@sebhub) gitlab at rtems.org
Wed Apr 1 03:04:02 UTC 2026




Sebastian Huber commented on a discussion: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5538#note_147740


I don't think overflow checks are needed at all. If you are scared that your uptime exceeds 38 years, you can set a timer which expires after 37 year and then reboot the system or do whatever. How likely is it that a system runs 38 years without a restart?

With respect to the micro-optimization, this is not only about addition, you may have to deal with 64-bit divisions and they can be very slow.

Changing the uptime limit outside the signed 32-bit range would impact the

```c
/**


 *   Define the Timestamp control type.
 */
typedef int64_t Timestamp_Control;
```

definition which is currently a signed 32-bit second and an unsigned 32-bit fraction. Changing this data structure to \> 64-bit will definitely impact the operating system performance.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5538#note_147740
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/20260401/2b969cb5/attachment.htm>


More information about the bugs mailing list