nuttx/clock: make NSEC_PER_USEC and others long

On AVR architecture, the compiler apparently sometimes truncates NSEC_PER_TICK
to 16bit value, leading to clock_time2ticks returning incorrect results. This
was encountered while attempting to add tickless OS support for AVR
architecture but seemed to affect non-tickless mode of operation as well.

This patch marks NSEC_PER_USEC (and to be safe, USEC_PER_MSEC and MSEC_PER_SEC
too) as long.
This commit is contained in:
Kerogit 2025-03-24 10:41:59 +01:00 committed by Alan C. Assis
parent 87c217ad93
commit ac42add946

View file

@ -103,7 +103,7 @@
#define NSEC_PER_SEC 1000000000L /* Seconds */
#define USEC_PER_SEC 1000000L
#define MSEC_PER_SEC 1000
#define MSEC_PER_SEC 1000L
#define DSEC_PER_SEC 10
#define HSEC_PER_SEC 2
@ -117,9 +117,9 @@
#define MSEC_PER_DSEC 100
#define NSEC_PER_MSEC 1000000L /* Milliseconds */
#define USEC_PER_MSEC 1000
#define USEC_PER_MSEC 1000L
#define NSEC_PER_USEC 1000 /* Microseconds */
#define NSEC_PER_USEC 1000L /* Microseconds */
#define SEC_PER_MIN 60
#define NSEC_PER_MIN (NSEC_PER_SEC * SEC_PER_MIN)