This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit c47b1e2c5b30cfd00afcce99ed021c77661d7b7f
Author: Xiang Xiao <[email protected]>
AuthorDate: Sun May 3 16:48:08 2026 +0800

    !sys/types.h: change time_t and clock_t to int64_t to align with other OSes
    
    POSIX leaves the signedness of time_t and clock_t unspecified, but
    mainstream implementations (Linux glibc/musl, the BSDs, macOS, RTEMS,
    Zephyr's POSIX layer, Windows _time64) expose time_t as signed 64-bit.
    NuttX has historically used uint64_t only because it was tied to the
    CONFIG_SYSTEM_TIME64 knob; with that gone, switch:
    
      time_t   : uint64_t  -> int64_t
      clock_t  : uint64_t  -> int64_t
      CLOCK_MAX: UINT64_MAX -> INT64_MAX
    
    This lets (time_t)-1 sentinels, negative tick deltas, and host-side
    headers behave as on every other POSIX system without source churn.
    
    Headers updated:
      - include/sys/types.h, include/limits.h, include/nuttx/clock.h
      - include/nuttx/fs/hostfs.h (nuttx_time_t alias)
      - include/nuttx/{mqueue.h,wdog.h,wqueue.h,timers/clkcnt.h}
    
    Because clock_t is now signed 64-bit, the NuttX-internal sclock_t
    alias becomes redundant: every sclock_t/SCLOCK_MAX use is folded
    back to clock_t/CLOCK_MAX (notably in sched/wdog, sched/mqueue,
    sched/sched, sched/clock, sched/timer, libs/libc/time, fs/vfs and
    the drivers/arch consumers below).
    
    Tick/period constants (NSEC_PER_SEC, USEC_PER_SEC, MSEC_PER_SEC,
    SEC_PER_MIN, ...) in include/nuttx/clock.h are retyped from "long"
    literals to INT64_C(...) so that 64-bit arithmetic no longer
    depends on the host's long width.
    
    Strip now-redundant (time_t)/(clock_t)/(unsigned long) casts and
    unsigned-only branches across the tree:
      - arch RTC / oneshot / tickless lowerhalfs:
          arm: cxd56xx, efm32, imxrt, lc823450, max326xx, sam34, sama5,
               samd5e5, samv7, stm32, stm32f7, stm32h7, stm32l4, stm32wb,
               xmc4
          mips: pic32mz       sparc: bm3803       x86_64: intel64
          risc-v/xtensa: espressif (esp_i2c[_slave], esp_rtc,
               esp32c3{_i2c,_rtc,_wifi_adapter}, esp32{,s2,s3}_*),
               mpfs_perf
      - drivers: audio/tone, input/aw86225, power/pm/{activity,
               stability}_governor, rpmsg/rpmsg_ping,
               timers/{ds3231,mcp794xx,pcf85263,rx8010},
               wireless/ieee80211/bcm43xxx, wireless/spirit/spirit_spi
      - core: fs/vfs/{fs_poll,fs_timerfd}, mm/iob/iob_alloc,
              libs/libc/{netdb/lib_dnscache,time/{lib_calendar2utc,
              lib_time}}, net/icmp/icmp_pmtu, net/icmpv6/icmpv6_pmtu,
              net/ipfrag, net/tcp/{tcp.h,tcp_timer},
              net/utils/net_snoop, net/mld/mld_query (drop the now-dead
              mld_mrc2mrd helper since signed math handles it directly),
              sched/clock/{clock,clock_initialize},
              sched/sched/{sched_profil,sched_setparam,sched_setscheduler},
              sched/pthread/pthread_create,
              sched/wdog/{wd_gettime,wd_start,wdog.h},
              sched/timer/timer_gettime, sched/mqueue/*
    
    Flip the few in-tree printf format strings that assumed an
    unsigned 64-bit tv_sec:
      * drivers/rpmsg/rpmsg_ping.c                       PRIu64 -> PRId64
      * arch/xtensa/src/esp32{,s2,s3}/esp32*_oneshot_lowerhalf.c
                                              PRIu32 (already wrong) -> PRId64
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 arch/arm/src/cxd56xx/cxd56_rtc.c                   |  2 +-
 arch/arm/src/efm32/efm32_rtc_burtc.c               |  2 +-
 arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c           |  2 +-
 arch/arm/src/lc823450/lc823450_rtc.c               |  2 +-
 arch/arm/src/lc823450/lc823450_timer.c             |  4 +-
 .../arm/src/max326xx/common/max326_rtc_lowerhalf.c |  2 +-
 arch/arm/src/sam34/sam4cm_oneshot.c                |  4 +-
 arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c      |  4 +-
 arch/arm/src/sama5/sam_oneshot.c                   |  4 +-
 arch/arm/src/sama5/sam_oneshot_lowerhalf.c         |  4 +-
 arch/arm/src/samd5e5/sam_oneshot.c                 |  4 +-
 arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c       |  4 +-
 arch/arm/src/samv7/sam_oneshot.c                   |  4 +-
 arch/arm/src/samv7/sam_oneshot_lowerhalf.c         |  4 +-
 arch/arm/src/stm32/stm32_oneshot.c                 |  4 +-
 arch/arm/src/stm32/stm32_oneshot_lowerhalf.c       |  4 +-
 arch/arm/src/stm32/stm32_tickless.c                |  6 +-
 arch/arm/src/stm32f7/stm32_tickless.c              |  6 +-
 arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c     |  4 +-
 arch/arm/src/stm32h7/stm32_tickless.c              |  6 +-
 arch/arm/src/stm32l4/stm32l4_oneshot.c             |  4 +-
 arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c   |  4 +-
 arch/arm/src/stm32wb/stm32wb_oneshot.c             |  4 +-
 arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c   |  4 +-
 arch/arm/src/stm32wb/stm32wb_tickless.c            |  6 +-
 arch/arm/src/xmc4/xmc4_tickless.c                  |  4 +-
 arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c |  2 +-
 arch/mips/src/pic32mz/pic32mz_oneshot.c            |  4 +-
 arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c  |  4 +-
 arch/risc-v/src/common/espressif/esp_i2c.c         |  2 +-
 arch/risc-v/src/common/espressif/esp_i2c_slave.c   |  2 +-
 arch/risc-v/src/common/espressif/esp_rtc.c         |  2 +-
 arch/risc-v/src/esp32c3-legacy/esp32c3_i2c.c       |  2 +-
 arch/risc-v/src/esp32c3-legacy/esp32c3_rtc.c       |  2 +-
 .../src/esp32c3-legacy/esp32c3_wifi_adapter.c      |  4 +-
 arch/risc-v/src/mpfs/mpfs_perf.c                   |  2 +-
 arch/sparc/src/bm3803/bm3803_oneshot.c             |  4 +-
 arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c   |  4 +-
 arch/x86_64/src/intel64/intel64_oneshot.c          |  4 +-
 arch/xtensa/src/common/espressif/esp_i2c_slave.c   |  2 +-
 arch/xtensa/src/common/espressif/esp_rtc.c         |  2 +-
 arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c    |  2 +-
 arch/xtensa/src/esp32/esp32_wifi_adapter.c         |  4 +-
 .../xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c |  2 +-
 arch/xtensa/src/esp32s2/esp32s2_wifi_adapter.c     |  4 +-
 .../xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c |  2 +-
 arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c     |  4 +-
 drivers/audio/tone.c                               | 16 ++--
 drivers/input/aw86225.c                            |  2 +-
 drivers/power/pm/activity_governor.c               |  8 +-
 drivers/power/pm/stability_governor.c              |  2 +-
 drivers/rpmsg/rpmsg_ping.c                         |  2 +-
 drivers/timers/ds3231.c                            |  2 +-
 drivers/timers/mcp794xx.c                          |  2 +-
 drivers/timers/pcf85263.c                          |  2 +-
 drivers/timers/rx8010.c                            |  2 +-
 drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h  |  2 +-
 drivers/wireless/spirit/lib/spirit_spi.c           | 10 +--
 fs/vfs/fs_poll.c                                   |  2 +-
 fs/vfs/fs_timerfd.c                                |  4 +-
 include/limits.h                                   |  2 +-
 include/nuttx/clock.h                              | 87 ++++++++++------------
 include/nuttx/fs/hostfs.h                          |  2 +-
 include/nuttx/mqueue.h                             |  4 +-
 include/nuttx/timers/clkcnt.h                      |  4 +-
 include/nuttx/wdog.h                               |  6 +-
 include/nuttx/wqueue.h                             |  2 +-
 include/sys/types.h                                |  9 ++-
 libs/libc/netdb/lib_dnscache.c                     | 11 +--
 libs/libc/time/lib_calendar2utc.c                  |  2 +-
 libs/libc/time/lib_time.c                          |  2 +-
 mm/iob/iob_alloc.c                                 |  2 +-
 net/icmp/icmp_pmtu.c                               |  8 +-
 net/icmpv6/icmpv6_pmtu.c                           |  6 +-
 net/ipfrag/ipfrag.c                                |  2 +-
 net/mld/mld_query.c                                | 38 +---------
 net/tcp/tcp.h                                      |  2 +-
 net/tcp/tcp_timer.c                                |  6 +-
 net/utils/net_snoop.c                              |  2 +-
 sched/clock/clock.c                                |  6 +-
 sched/clock/clock_initialize.c                     |  2 +-
 sched/mqueue/mq_rcvinternal.c                      |  2 +-
 sched/mqueue/mq_receive.c                          |  4 +-
 sched/mqueue/mq_send.c                             |  4 +-
 sched/mqueue/mq_sndinternal.c                      |  2 +-
 sched/mqueue/mqueue.h                              |  4 +-
 sched/pthread/pthread_create.c                     |  4 +-
 sched/sched/sched_profil.c                         |  2 +-
 sched/sched/sched_setparam.c                       |  4 +-
 sched/sched/sched_setscheduler.c                   |  4 +-
 sched/timer/timer_gettime.c                        |  2 +-
 sched/wdog/wd_gettime.c                            |  6 +-
 sched/wdog/wd_start.c                              |  2 +-
 sched/wdog/wdog.h                                  |  6 +-
 94 files changed, 207 insertions(+), 262 deletions(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_rtc.c b/arch/arm/src/cxd56xx/cxd56_rtc.c
index 35da54eea50..cd7e4338992 100644
--- a/arch/arm/src/cxd56xx/cxd56_rtc.c
+++ b/arch/arm/src/cxd56xx/cxd56_rtc.c
@@ -394,7 +394,7 @@ time_t up_rtc_time(void)
   count += g_rtc_save->offset;
   count >>= 15; /* convert to 1sec resolution */
 
-  return (time_t)count / CONFIG_RTC_FREQUENCY;
+  return count / CONFIG_RTC_FREQUENCY;
 }
 #endif
 
diff --git a/arch/arm/src/efm32/efm32_rtc_burtc.c 
b/arch/arm/src/efm32/efm32_rtc_burtc.c
index dd86566dfcd..c3f8a128cbd 100644
--- a/arch/arm/src/efm32/efm32_rtc_burtc.c
+++ b/arch/arm/src/efm32/efm32_rtc_burtc.c
@@ -398,7 +398,7 @@ int up_rtc_initialize(void)
 #ifndef CONFIG_RTC_HIRES
 time_t up_rtc_time(void)
 {
-  return (time_t)efm32_get_burtc_tick() / CONFIG_RTC_FREQUENCY;
+  return efm32_get_burtc_tick() / CONFIG_RTC_FREQUENCY;
 }
 #endif
 
diff --git a/arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c 
b/arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c
index ee913467e5d..60fbbdfcde5 100644
--- a/arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c
+++ b/arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c
@@ -463,7 +463,7 @@ static int imxrt_rdalarm(struct rtc_lowerhalf_s *lower,
 
       /* Get the current alarm setting in seconds */
 
-      alarm = (time_t)imxrt_hprtc_getalarm();
+      alarm = imxrt_hprtc_getalarm();
 
       /* Convert the one second epoch time to a struct tm */
 
diff --git a/arch/arm/src/lc823450/lc823450_rtc.c 
b/arch/arm/src/lc823450/lc823450_rtc.c
index 09fbf31dd7f..5ea1cf43f01 100644
--- a/arch/arm/src/lc823450/lc823450_rtc.c
+++ b/arch/arm/src/lc823450/lc823450_rtc.c
@@ -173,7 +173,7 @@ static void tm_divider(struct tm *tm, int divn, int divm)
 {
   time_t tt;
   tt = timegm(tm);
-  tt = (time_t) ((uint64_t)tt * divn / divm);
+  tt = tt * divn / divm;
   gmtime_r(&tt, tm);
 }
 #endif /* CONFIG_RTC_DIV */
diff --git a/arch/arm/src/lc823450/lc823450_timer.c 
b/arch/arm/src/lc823450/lc823450_timer.c
index 6dd954afa6a..b56562b48be 100644
--- a/arch/arm/src/lc823450/lc823450_timer.c
+++ b/arch/arm/src/lc823450/lc823450_timer.c
@@ -724,8 +724,8 @@ int up_rtc_gettime(struct timespec *tp)
 
   /* And return the result to the caller. */
 
-  tp->tv_sec  = (time_t)secs;
-  tp->tv_nsec = (long)nsecs;
+  tp->tv_sec  = secs;
+  tp->tv_nsec = nsecs;
 
   tmrinfo("Returning tp=(%d,%d)\n", (int)tp->tv_sec, (int)tp->tv_nsec);
   return OK;
diff --git a/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c 
b/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c
index 6c98f886772..e2aeae243c2 100644
--- a/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c
+++ b/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c
@@ -581,7 +581,7 @@ static int max326_rdalarm(struct rtc_lowerhalf_s *lower,
         {
           /* Extract integer seconds from the b32_t value */
 
-          time_t sec = (time_t)(b32toi(ftime));
+          time_t sec = b32toi(ftime);
 
           /* Convert to struct rtc_time (aka struct tm) */
 
diff --git a/arch/arm/src/sam34/sam4cm_oneshot.c 
b/arch/arm/src/sam34/sam4cm_oneshot.c
index 6c31b6d42ab..7a5c1bcbbcc 100644
--- a/arch/arm/src/sam34/sam4cm_oneshot.c
+++ b/arch/arm/src/sam34/sam4cm_oneshot.c
@@ -496,8 +496,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c 
b/arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c
index 3ab83141b51..c9b41346f61 100644
--- a/arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c
+++ b/arch/arm/src/sam34/sam4cm_oneshot_lowerhalf.c
@@ -152,8 +152,8 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/arm/src/sama5/sam_oneshot.c b/arch/arm/src/sama5/sam_oneshot.c
index 04c35719e79..12fd473aca9 100644
--- a/arch/arm/src/sama5/sam_oneshot.c
+++ b/arch/arm/src/sama5/sam_oneshot.c
@@ -507,8 +507,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/arm/src/sama5/sam_oneshot_lowerhalf.c 
b/arch/arm/src/sama5/sam_oneshot_lowerhalf.c
index cfa4f72ea03..dd7bf88489d 100644
--- a/arch/arm/src/sama5/sam_oneshot_lowerhalf.c
+++ b/arch/arm/src/sama5/sam_oneshot_lowerhalf.c
@@ -154,8 +154,8 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/arm/src/samd5e5/sam_oneshot.c 
b/arch/arm/src/samd5e5/sam_oneshot.c
index cb5911fb6bb..b55b72c862a 100644
--- a/arch/arm/src/samd5e5/sam_oneshot.c
+++ b/arch/arm/src/samd5e5/sam_oneshot.c
@@ -441,8 +441,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c 
b/arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c
index 28ec61c34de..7373e522fef 100644
--- a/arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c
+++ b/arch/arm/src/samd5e5/sam_oneshot_lowerhalf.c
@@ -152,8 +152,8 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/arm/src/samv7/sam_oneshot.c b/arch/arm/src/samv7/sam_oneshot.c
index 1052435b409..71abe873208 100644
--- a/arch/arm/src/samv7/sam_oneshot.c
+++ b/arch/arm/src/samv7/sam_oneshot.c
@@ -506,8 +506,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/arm/src/samv7/sam_oneshot_lowerhalf.c 
b/arch/arm/src/samv7/sam_oneshot_lowerhalf.c
index 59482efb46f..593bd88294c 100644
--- a/arch/arm/src/samv7/sam_oneshot_lowerhalf.c
+++ b/arch/arm/src/samv7/sam_oneshot_lowerhalf.c
@@ -152,8 +152,8 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/arm/src/stm32/stm32_oneshot.c 
b/arch/arm/src/stm32/stm32_oneshot.c
index 95a507b7619..f05832e3d2a 100644
--- a/arch/arm/src/stm32/stm32_oneshot.c
+++ b/arch/arm/src/stm32/stm32_oneshot.c
@@ -445,8 +445,8 @@ int stm32_oneshot_cancel(struct stm32_oneshot_s *oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c 
b/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c
index 8d1bf6488f9..8d5c5c79a28 100644
--- a/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c
+++ b/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c
@@ -151,8 +151,8 @@ static int stm32_max_delay(struct oneshot_lowerhalf_s 
*lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/arm/src/stm32/stm32_tickless.c 
b/arch/arm/src/stm32/stm32_tickless.c
index 7ddd226cd8d..0d3634c8bda 100644
--- a/arch/arm/src/stm32/stm32_tickless.c
+++ b/arch/arm/src/stm32/stm32_tickless.c
@@ -710,7 +710,7 @@ int up_timer_gettime(struct timespec *ts)
 
 int up_timer_gettick(clock_t *ticks)
 {
-  *ticks = (clock_t)STM32_TIM_GETCOUNTER(g_tickless.tch);
+  *ticks = STM32_TIM_GETCOUNTER(g_tickless.tch);
   return OK;
 }
 
@@ -869,8 +869,8 @@ int up_timer_cancel(struct timespec *ts)
       sec         = usec / USEC_PER_SEC;
       nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (unsigned long)nsec;
+      ts->tv_sec  = sec;
+      ts->tv_nsec = nsec;
 
       tmrinfo("remaining (%lu, %lu)\n",
              (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
diff --git a/arch/arm/src/stm32f7/stm32_tickless.c 
b/arch/arm/src/stm32f7/stm32_tickless.c
index bf0c10d350e..d809b623c5d 100644
--- a/arch/arm/src/stm32f7/stm32_tickless.c
+++ b/arch/arm/src/stm32f7/stm32_tickless.c
@@ -751,7 +751,7 @@ int up_timer_gettime(struct timespec *ts)
 
 int up_timer_gettick(clock_t *ticks)
 {
-  *ticks = (clock_t)STM32_TIM_GETCOUNTER(g_tickless.tch);
+  *ticks = STM32_TIM_GETCOUNTER(g_tickless.tch);
   return OK;
 }
 
@@ -911,8 +911,8 @@ int up_timer_cancel(struct timespec *ts)
       sec         = usec / USEC_PER_SEC;
       nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (unsigned long)nsec;
+      ts->tv_sec  = sec;
+      ts->tv_nsec = nsec;
 
       tmrinfo("remaining (%lu, %lu)\n",
              (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
diff --git a/arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c 
b/arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c
index 3cc03d1bf17..edec93ec7ec 100644
--- a/arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c
+++ b/arch/arm/src/stm32h7/stm32_oneshot_lowerhalf.c
@@ -151,8 +151,8 @@ static int stm32_max_delay(struct oneshot_lowerhalf_s 
*lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/arm/src/stm32h7/stm32_tickless.c 
b/arch/arm/src/stm32h7/stm32_tickless.c
index 06d4651ba13..3a9896b14e6 100644
--- a/arch/arm/src/stm32h7/stm32_tickless.c
+++ b/arch/arm/src/stm32h7/stm32_tickless.c
@@ -725,7 +725,7 @@ int up_timer_gettime(struct timespec *ts)
 
 int up_timer_gettick(clock_t *ticks)
 {
-  *ticks = (clock_t)STM32_TIM_GETCOUNTER(g_tickless.tch);
+  *ticks = STM32_TIM_GETCOUNTER(g_tickless.tch);
   return OK;
 }
 
@@ -885,8 +885,8 @@ int up_timer_cancel(struct timespec *ts)
       sec         = usec / USEC_PER_SEC;
       nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (unsigned long)nsec;
+      ts->tv_sec  = sec;
+      ts->tv_nsec = nsec;
 
       tmrinfo("remaining (%lu, %lu)\n",
              (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
diff --git a/arch/arm/src/stm32l4/stm32l4_oneshot.c 
b/arch/arm/src/stm32l4/stm32l4_oneshot.c
index 70b41f1ed11..41c6e5dc83c 100644
--- a/arch/arm/src/stm32l4/stm32l4_oneshot.c
+++ b/arch/arm/src/stm32l4/stm32l4_oneshot.c
@@ -447,8 +447,8 @@ int stm32l4_oneshot_cancel(struct stm32l4_oneshot_s 
*oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c 
b/arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c
index e5143d7a02c..7dd0b0cd73f 100644
--- a/arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c
+++ b/arch/arm/src/stm32l4/stm32l4_oneshot_lowerhalf.c
@@ -152,8 +152,8 @@ static int stm32l4_max_delay(struct oneshot_lowerhalf_s 
*lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/arm/src/stm32wb/stm32wb_oneshot.c 
b/arch/arm/src/stm32wb/stm32wb_oneshot.c
index d9356f01b32..612ec69f93e 100644
--- a/arch/arm/src/stm32wb/stm32wb_oneshot.c
+++ b/arch/arm/src/stm32wb/stm32wb_oneshot.c
@@ -446,8 +446,8 @@ int stm32wb_oneshot_cancel(struct stm32wb_oneshot_s 
*oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c 
b/arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c
index 17e05eefe97..4c1b7030377 100644
--- a/arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c
+++ b/arch/arm/src/stm32wb/stm32wb_oneshot_lowerhalf.c
@@ -152,8 +152,8 @@ static int stm32wb_max_delay(struct oneshot_lowerhalf_s 
*lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/arm/src/stm32wb/stm32wb_tickless.c 
b/arch/arm/src/stm32wb/stm32wb_tickless.c
index 00769c2ba85..c27c9790af4 100644
--- a/arch/arm/src/stm32wb/stm32wb_tickless.c
+++ b/arch/arm/src/stm32wb/stm32wb_tickless.c
@@ -576,7 +576,7 @@ int up_timer_gettime(struct timespec *ts)
 
 int up_timer_gettick(clock_t *ticks)
 {
-  *ticks = (clock_t)STM32WB_TIM_GETCOUNTER(g_tickless.tch);
+  *ticks = STM32WB_TIM_GETCOUNTER(g_tickless.tch);
   return OK;
 }
 
@@ -735,8 +735,8 @@ int up_timer_cancel(struct timespec *ts)
       sec         = usec / USEC_PER_SEC;
       nsec        = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (unsigned long)nsec;
+      ts->tv_sec  = sec;
+      ts->tv_nsec = nsec;
 
       tmrinfo("remaining (%lu, %lu)\n",
               (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
diff --git a/arch/arm/src/xmc4/xmc4_tickless.c 
b/arch/arm/src/xmc4/xmc4_tickless.c
index a15241254d8..1e8caebe04c 100644
--- a/arch/arm/src/xmc4/xmc4_tickless.c
+++ b/arch/arm/src/xmc4/xmc4_tickless.c
@@ -563,8 +563,8 @@ int up_timer_cancel(struct timespec *ts)
 
       sec         = usec / USEC_PER_SEC;
       nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (unsigned long)nsec;
+      ts->tv_sec  = sec;
+      ts->tv_nsec = nsec;
 
       tmrinfo("remaining count : %lu (%lu, %lu)\n", count,
               (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
diff --git a/arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c 
b/arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c
index 927069b0ce8..99bd4972bef 100644
--- a/arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c
+++ b/arch/avr/src/avrdx/avrdx_timerisr_tickless_alarm.c
@@ -301,7 +301,7 @@ static void avrdx_check_alarm_expired(uint8_t context)
 
       /* Note about data types - struct timespec is defined
        * in include/time.h, tv_sec is of type time_t which is defined
-       * in include/sys/types.h as uint64_t.
+       * in include/sys/types.h as int64_t.
        *
        * tv_nsec is defined as long, signed value
        */
diff --git a/arch/mips/src/pic32mz/pic32mz_oneshot.c 
b/arch/mips/src/pic32mz/pic32mz_oneshot.c
index e845875b735..34d5f89a83c 100644
--- a/arch/mips/src/pic32mz/pic32mz_oneshot.c
+++ b/arch/mips/src/pic32mz/pic32mz_oneshot.c
@@ -433,8 +433,8 @@ int pic32mz_oneshot_cancel(struct pic32mz_oneshot_s 
*oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c 
b/arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c
index 19b82b908d8..b1b7537e911 100644
--- a/arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c
+++ b/arch/mips/src/pic32mz/pic32mz_oneshot_lowerhalf.c
@@ -153,8 +153,8 @@ static int pic32mz_max_delay(struct oneshot_lowerhalf_s 
*lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/risc-v/src/common/espressif/esp_i2c.c 
b/arch/risc-v/src/common/espressif/esp_i2c.c
index 68707e10a58..5abb1ecd39a 100644
--- a/arch/risc-v/src/common/espressif/esp_i2c.c
+++ b/arch/risc-v/src/common/espressif/esp_i2c.c
@@ -1052,7 +1052,7 @@ static int esp_i2c_polling_waitdone(struct esp_i2c_priv_s 
*priv)
    * and an error didn't occur within the timeout
    */
 
-  while ((sclock_t)(current - timeout) < 0 && (priv->error == 0))
+  while (current - timeout < 0 && priv->error == 0)
     {
       /* Check if any interrupt triggered, clear them
        * process the operation.
diff --git a/arch/risc-v/src/common/espressif/esp_i2c_slave.c 
b/arch/risc-v/src/common/espressif/esp_i2c_slave.c
index 10ca9e06877..24b565d9ced 100644
--- a/arch/risc-v/src/common/espressif/esp_i2c_slave.c
+++ b/arch/risc-v/src/common/espressif/esp_i2c_slave.c
@@ -679,7 +679,7 @@ static int esp_i2c_slave_polling_waitdone(struct 
esp_i2c_priv_s *priv)
   current = clock_systime_ticks();
   timeout = current + SEC2TICK(I2C_SLAVE_POLL_RATE);
 
-  while ((sclock_t)(current - timeout) < 0)
+  while (current - timeout < 0)
     {
       /* Check if any interrupt triggered, clear them
        * process the operation.
diff --git a/arch/risc-v/src/common/espressif/esp_rtc.c 
b/arch/risc-v/src/common/espressif/esp_rtc.c
index 0896312e1f8..7c404e028d5 100644
--- a/arch/risc-v/src/common/espressif/esp_rtc.c
+++ b/arch/risc-v/src/common/espressif/esp_rtc.c
@@ -699,7 +699,7 @@ time_t up_rtc_time(void)
 
   spin_unlock_irqrestore(&g_rtc_lowerhalf.lock, flags);
 
-  return (time_t)(time_us / USEC_PER_SEC);
+  return time_us / USEC_PER_SEC;
 }
 #endif /* !CONFIG_RTC_HIRES */
 
diff --git a/arch/risc-v/src/esp32c3-legacy/esp32c3_i2c.c 
b/arch/risc-v/src/esp32c3-legacy/esp32c3_i2c.c
index 72f0f81618e..a03bff8d9c5 100644
--- a/arch/risc-v/src/esp32c3-legacy/esp32c3_i2c.c
+++ b/arch/risc-v/src/esp32c3-legacy/esp32c3_i2c.c
@@ -846,7 +846,7 @@ static int esp32c3_i2c_polling_waitdone(struct 
esp32c3_i2c_priv_s *priv)
    * and an error didn't occur within the timeout
    */
 
-  while ((sclock_t)(current - timeout) < 0 && (priv->error == 0))
+  while (current - timeout < 0 && priv->error == 0)
     {
       /* Check if any interrupt triggered, clear them
        * process the operation.
diff --git a/arch/risc-v/src/esp32c3-legacy/esp32c3_rtc.c 
b/arch/risc-v/src/esp32c3-legacy/esp32c3_rtc.c
index 8c48f8f5a60..3d97fb6a7c8 100644
--- a/arch/risc-v/src/esp32c3-legacy/esp32c3_rtc.c
+++ b/arch/risc-v/src/esp32c3-legacy/esp32c3_rtc.c
@@ -3108,7 +3108,7 @@ time_t up_rtc_time(void)
 
   spin_unlock_irqrestore(&g_rtc_lock, flags);
 
-  return (time_t)(time_us / USEC_PER_SEC);
+  return time_us / USEC_PER_SEC;
 }
 #endif /* !CONFIG_RTC_HIRES */
 
diff --git a/arch/risc-v/src/esp32c3-legacy/esp32c3_wifi_adapter.c 
b/arch/risc-v/src/esp32c3-legacy/esp32c3_wifi_adapter.c
index 51a6bea4110..0f1d1769678 100644
--- a/arch/risc-v/src/esp32c3-legacy/esp32c3_wifi_adapter.c
+++ b/arch/risc-v/src/esp32c3-legacy/esp32c3_wifi_adapter.c
@@ -3289,8 +3289,8 @@ static int esp_get_time(void *t)
   ret = gettimeofday(&tv, NULL);
   if (!ret)
     {
-      time_adpt->sec  = (time_t)tv.tv_sec;
-      time_adpt->usec = (suseconds_t)tv.tv_usec;
+      time_adpt->sec  = tv.tv_sec;
+      time_adpt->usec = tv.tv_usec;
     }
   else
     {
diff --git a/arch/risc-v/src/mpfs/mpfs_perf.c b/arch/risc-v/src/mpfs/mpfs_perf.c
index 2cdf7c29a64..aa32ac3b00c 100644
--- a/arch/risc-v/src/mpfs/mpfs_perf.c
+++ b/arch/risc-v/src/mpfs/mpfs_perf.c
@@ -90,7 +90,7 @@ void up_udelay(useconds_t microseconds)
 {
   clock_t start = up_perf_gettime();
   clock_t end = microseconds * up_perf_getfreq() / USEC_PER_SEC + start + 1;
-  while (((sclock_t)(up_perf_gettime() - end)) < 0)
+  while (up_perf_gettime() - end < 0)
     {
     }
 }
diff --git a/arch/sparc/src/bm3803/bm3803_oneshot.c 
b/arch/sparc/src/bm3803/bm3803_oneshot.c
index 89b9589c185..4c7f9bba616 100644
--- a/arch/sparc/src/bm3803/bm3803_oneshot.c
+++ b/arch/sparc/src/bm3803/bm3803_oneshot.c
@@ -389,8 +389,8 @@ int bm3803_oneshot_cancel(struct bm3803_oneshot_s *oneshot,
           sec         = usec / USEC_PER_SEC;
           nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts->tv_sec  = (time_t)sec;
-          ts->tv_nsec = (unsigned long)nsec;
+          ts->tv_sec  = sec;
+          ts->tv_nsec = nsec;
         }
 
       tmrinfo("remaining (%lu, %lu)\n",
diff --git a/arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c 
b/arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c
index c28ef7ca0c8..8e2aeffc171 100644
--- a/arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c
+++ b/arch/sparc/src/bm3803/bm3803_oneshot_lowerhalf.c
@@ -154,8 +154,8 @@ static int bm3803_max_delay(struct oneshot_lowerhalf_s 
*lower,
       uint64_t sec = usecs / 1000000;
       usecs -= 1000000 * sec;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (long)(usecs * 1000);
+      ts->tv_sec  = sec;
+      ts->tv_nsec = usecs * 1000;
     }
 
   return ret;
diff --git a/arch/x86_64/src/intel64/intel64_oneshot.c 
b/arch/x86_64/src/intel64/intel64_oneshot.c
index d9f3da5b517..62f562698a2 100644
--- a/arch/x86_64/src/intel64/intel64_oneshot.c
+++ b/arch/x86_64/src/intel64/intel64_oneshot.c
@@ -461,8 +461,8 @@ int intel64_oneshot_cancel(struct intel64_oneshot_s 
*oneshot,
       sec         = usec / USEC_PER_SEC;
       nsec        = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-      ts->tv_sec  = (time_t)sec;
-      ts->tv_nsec = (unsigned long)nsec;
+      ts->tv_sec  = sec;
+      ts->tv_nsec = nsec;
 
       tmrinfo("remaining (%lu, %lu)\n",
              (unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
diff --git a/arch/xtensa/src/common/espressif/esp_i2c_slave.c 
b/arch/xtensa/src/common/espressif/esp_i2c_slave.c
index 8ecfcb7bf43..500c8837d8e 100644
--- a/arch/xtensa/src/common/espressif/esp_i2c_slave.c
+++ b/arch/xtensa/src/common/espressif/esp_i2c_slave.c
@@ -694,7 +694,7 @@ static int esp_i2c_slave_polling_waitdone(struct 
esp_i2c_priv_s *priv)
   current = clock_systime_ticks();
   timeout = current + SEC2TICK(I2C_SLAVE_POLL_RATE);
 
-  while ((sclock_t)(current - timeout) < 0)
+  while (current - timeout < 0)
     {
       /* Check if any interrupt triggered, clear them
        * process the operation.
diff --git a/arch/xtensa/src/common/espressif/esp_rtc.c 
b/arch/xtensa/src/common/espressif/esp_rtc.c
index 2683e118f4a..c47ac898d57 100644
--- a/arch/xtensa/src/common/espressif/esp_rtc.c
+++ b/arch/xtensa/src/common/espressif/esp_rtc.c
@@ -698,7 +698,7 @@ time_t up_rtc_time(void)
 
   spin_unlock_irqrestore(&g_rtc_lowerhalf.lock, flags);
 
-  return (time_t)(time_us / USEC_PER_SEC);
+  return time_us / USEC_PER_SEC;
 }
 #endif /* !CONFIG_RTC_HIRES */
 
diff --git a/arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c 
b/arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c
index cf6de7ede4a..8a5452ddb7e 100644
--- a/arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c
+++ b/arch/xtensa/src/esp32/esp32_oneshot_lowerhalf.c
@@ -154,7 +154,7 @@ static int esp32_max_lh_delay(struct oneshot_lowerhalf_s 
*lower,
   ts->tv_sec  = UINT32_MAX;
   ts->tv_nsec = NSEC_PER_SEC - 1;
 
-  tmrinfo("max sec=%" PRIu32 "\n", ts->tv_sec);
+  tmrinfo("max sec=%" PRId64 "\n", ts->tv_sec);
   tmrinfo("max nsec=%" PRId32 "\n", ts->tv_nsec);
 
   return OK;
diff --git a/arch/xtensa/src/esp32/esp32_wifi_adapter.c 
b/arch/xtensa/src/esp32/esp32_wifi_adapter.c
index 6d372ab3007..75edeee95ac 100644
--- a/arch/xtensa/src/esp32/esp32_wifi_adapter.c
+++ b/arch/xtensa/src/esp32/esp32_wifi_adapter.c
@@ -2594,8 +2594,8 @@ static int esp_get_time(void *t)
   ret = gettimeofday(&tv, NULL);
   if (!ret)
     {
-      time_adpt->sec  = (time_t)tv.tv_sec;
-      time_adpt->usec = (suseconds_t)tv.tv_usec;
+      time_adpt->sec  = tv.tv_sec;
+      time_adpt->usec = tv.tv_usec;
     }
   else
     {
diff --git a/arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c 
b/arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c
index cdfbbe7098b..d2de715a5f8 100644
--- a/arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c
+++ b/arch/xtensa/src/esp32s2/esp32s2_oneshot_lowerhalf.c
@@ -155,7 +155,7 @@ static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s 
*lower,
   ts->tv_sec  = UINT32_MAX;
   ts->tv_nsec = NSEC_PER_SEC - 1;
 
-  tmrinfo("max sec=%" PRIu32 "\n", ts->tv_sec);
+  tmrinfo("max sec=%" PRId64 "\n", ts->tv_sec);
   tmrinfo("max nsec=%ld\n", ts->tv_nsec);
 
   return OK;
diff --git a/arch/xtensa/src/esp32s2/esp32s2_wifi_adapter.c 
b/arch/xtensa/src/esp32s2/esp32s2_wifi_adapter.c
index bd8a24a4cbb..9f3ea5c287f 100644
--- a/arch/xtensa/src/esp32s2/esp32s2_wifi_adapter.c
+++ b/arch/xtensa/src/esp32s2/esp32s2_wifi_adapter.c
@@ -2412,8 +2412,8 @@ static int esp_get_time(void *t)
   ret = gettimeofday(&tv, NULL);
   if (!ret)
     {
-      time_adpt->sec  = (time_t)tv.tv_sec;
-      time_adpt->usec = (suseconds_t)tv.tv_usec;
+      time_adpt->sec  = tv.tv_sec;
+      time_adpt->usec = tv.tv_usec;
     }
   else
     {
diff --git a/arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c 
b/arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c
index eb07a398087..ccc60ac5aaf 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_oneshot_lowerhalf.c
@@ -155,7 +155,7 @@ static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s 
*lower,
   ts->tv_sec  = UINT32_MAX;
   ts->tv_nsec = NSEC_PER_SEC - 1;
 
-  tmrinfo("max sec=%" PRIu32 "\n", ts->tv_sec);
+  tmrinfo("max sec=%" PRId64 "\n", ts->tv_sec);
   tmrinfo("max nsec=%ld\n", ts->tv_nsec);
 
   return OK;
diff --git a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c 
b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c
index 6c615e8e388..ffd7aad445b 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c
@@ -2584,8 +2584,8 @@ static int esp_get_time(void *t)
   ret = gettimeofday(&tv, NULL);
   if (!ret)
     {
-      time_adpt->sec  = (time_t)tv.tv_sec;
-      time_adpt->usec = (suseconds_t)tv.tv_usec;
+      time_adpt->sec  = tv.tv_sec;
+      time_adpt->usec = tv.tv_usec;
     }
   else
     {
diff --git a/drivers/audio/tone.c b/drivers/audio/tone.c
index 3504d012f11..720d9c6ee9e 100644
--- a/drivers/audio/tone.c
+++ b/drivers/audio/tone.c
@@ -377,8 +377,8 @@ static void next_note(FAR struct tone_upperhalf_s *upper)
       sec = duration / USEC_PER_SEC;
       nsec = ((duration) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-      ts.tv_sec = (time_t) sec;
-      ts.tv_nsec = (unsigned long)nsec;
+      ts.tv_sec = sec;
+      ts.tv_nsec = nsec;
 
       ONESHOT_START(upper->oneshot, &ts);
 
@@ -511,8 +511,8 @@ static void next_note(FAR struct tone_upperhalf_s *upper)
           sec = duration / USEC_PER_SEC;
           nsec = ((duration) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-          ts.tv_sec = (time_t) sec;
-          ts.tv_nsec = (unsigned long)nsec;
+          ts.tv_sec = sec;
+          ts.tv_nsec = nsec;
 
           ONESHOT_START(upper->oneshot, &ts);
           return;
@@ -554,8 +554,8 @@ static void next_note(FAR struct tone_upperhalf_s *upper)
               sec = duration / USEC_PER_SEC;
               nsec = ((duration) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-              ts.tv_sec = (time_t) sec;
-              ts.tv_nsec = (unsigned long)nsec;
+              ts.tv_sec = sec;
+              ts.tv_nsec = nsec;
 
               ONESHOT_START(upper->oneshot, &ts);
 
@@ -636,8 +636,8 @@ static void next_note(FAR struct tone_upperhalf_s *upper)
   sec = duration / USEC_PER_SEC;
   nsec = ((duration) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
 
-  ts.tv_sec = (time_t) sec;
-  ts.tv_nsec = (unsigned long)nsec;
+  ts.tv_sec = sec;
+  ts.tv_nsec = nsec;
 
   /* And arrange a callback when the note should stop */
 
diff --git a/drivers/input/aw86225.c b/drivers/input/aw86225.c
index 68ba23a4878..24b98cbb4f7 100644
--- a/drivers/input/aw86225.c
+++ b/drivers/input/aw86225.c
@@ -2144,7 +2144,7 @@ static int aw86225_haptics_upload_effect(FAR struct 
ff_lowerhalf_s *lower,
   FAR struct aw86225 *aw86225 = (FAR struct aw86225 *)lower;
   FAR struct aw86225_hap_play_info *play = &aw86225->play;
   int16_t data[AW86225_CUSTOM_DATA_LEN];
-  sclock_t time_us;
+  clock_t time_us;
   int ret;
 
   time_us = wd_gettime(&aw86225->timer);
diff --git a/drivers/power/pm/activity_governor.c 
b/drivers/power/pm/activity_governor.c
index 51c3859103d..c757fb1af9f 100644
--- a/drivers/power/pm/activity_governor.c
+++ b/drivers/power/pm/activity_governor.c
@@ -573,10 +573,10 @@ static void governor_timer(int domain, enum pm_state_e 
newstate)
 
   if (newstate < PM_SLEEP && dq_empty(&pdom->wakelock[newstate]))
     {
-      sclock_t delay = pmtick[newstate] +
-                       pdomstate->btime -
-                       clock_systime_ticks();
-      sclock_t left  = wd_gettime(&pdomstate->wdog);
+      clock_t delay = pmtick[newstate] +
+                      pdomstate->btime -
+                      clock_systime_ticks();
+      clock_t left  = wd_gettime(&pdomstate->wdog);
 
       if (delay <= 0)
         {
diff --git a/drivers/power/pm/stability_governor.c 
b/drivers/power/pm/stability_governor.c
index 4fd2b8d1a01..ced75cbc38a 100644
--- a/drivers/power/pm/stability_governor.c
+++ b/drivers/power/pm/stability_governor.c
@@ -115,7 +115,7 @@ static void stability_governor_statechanged(int domain,
     {
       if (WDOG_ISACTIVE(&g_stability_governor.domain[domain].wdog))
         {
-          sclock_t left;
+          clock_t left;
 
           /* The left tick from wdog, if >0 should be other irq source */
 
diff --git a/drivers/rpmsg/rpmsg_ping.c b/drivers/rpmsg/rpmsg_ping.c
index e837e8bf94d..7784430e885 100644
--- a/drivers/rpmsg/rpmsg_ping.c
+++ b/drivers/rpmsg/rpmsg_ping.c
@@ -189,7 +189,7 @@ static void rpmsg_ping_logout(FAR const char *s, clock_t 
value)
 
   perf_convert(value, &ts);
 
-  syslog(LOG_EMERG, "%s: %" PRIu64 " s, %ld ns\n", s, ts.tv_sec, ts.tv_nsec);
+  syslog(LOG_EMERG, "%s: %" PRId64 " s, %ld ns\n", s, ts.tv_sec, ts.tv_nsec);
 }
 
 static void rpmsg_ping_logout_rate(uint64_t len, clock_t avg)
diff --git a/drivers/timers/ds3231.c b/drivers/timers/ds3231.c
index 6a997946a7f..21b4d2b2f9e 100644
--- a/drivers/timers/ds3231.c
+++ b/drivers/timers/ds3231.c
@@ -409,7 +409,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
 
   /* Get the broken out time */
 
-  newtime = (time_t)tp->tv_sec;
+  newtime = tp->tv_sec;
   if (tp->tv_nsec >= 500000000)
     {
       /* Round up */
diff --git a/drivers/timers/mcp794xx.c b/drivers/timers/mcp794xx.c
index 272701991a8..7d4d786ec73 100644
--- a/drivers/timers/mcp794xx.c
+++ b/drivers/timers/mcp794xx.c
@@ -502,7 +502,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
 
   /* Get the broken out time */
 
-  newtime = (time_t)tp->tv_sec;
+  newtime = tp->tv_sec;
   if (tp->tv_nsec >= 500000000)
     {
       /* Round up */
diff --git a/drivers/timers/pcf85263.c b/drivers/timers/pcf85263.c
index 72a45120389..7e621c248a5 100644
--- a/drivers/timers/pcf85263.c
+++ b/drivers/timers/pcf85263.c
@@ -392,7 +392,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
 
   /* Get the broken out time */
 
-  newtime = (time_t)tp->tv_sec;
+  newtime = tp->tv_sec;
   if (tp->tv_nsec >= 500000000)
     {
       /* Round up */
diff --git a/drivers/timers/rx8010.c b/drivers/timers/rx8010.c
index 7bf26392815..b4189b663e7 100644
--- a/drivers/timers/rx8010.c
+++ b/drivers/timers/rx8010.c
@@ -397,7 +397,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
 
   /* Get the broken out time */
 
-  newtime = (time_t)tp->tv_sec;
+  newtime = tp->tv_sec;
   if (tp->tv_nsec >= 500000000)
     {
       /* Round up */
diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h 
b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h
index f11e25f4ff2..02c348ff358 100644
--- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h
+++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h
@@ -106,7 +106,7 @@ struct bcmf_dev_s
   struct work_s lp_work_ifdown; /* Ifdown work to work queue */
   struct work_s lp_work_dtim;   /* Low power work to work queue */
   int           lp_dtim;        /* Listen interval Delivery Traffic Indication 
Message */
-  sclock_t      lp_ticks;       /* Ticks of last tx time */
+  clock_t       lp_ticks;       /* Ticks of last tx time */
 #endif
 #ifdef CONFIG_IEEE80211_BROADCOM_PTA_PRIORITY
   int pta_priority; /* Current priority of Packet Traffic Arbitration */
diff --git a/drivers/wireless/spirit/lib/spirit_spi.c 
b/drivers/wireless/spirit/lib/spirit_spi.c
index 941c2f4b5ff..8cfd25fca4b 100644
--- a/drivers/wireless/spirit/lib/spirit_spi.c
+++ b/drivers/wireless/spirit/lib/spirit_spi.c
@@ -635,17 +635,9 @@ int spirit_waitstatus(FAR struct spirit_library_s *spirit,
   /* Convert the MSEC timedelay to clock ticks, making sure that the
    * resulting delay in ticks is greater than or equal to the requested time
    * in MSEC.
-   *
-   * REVISIT: If USEC_PER_TICK and 'msec' are large, then the second
-   * computation may overflow!
    */
 
-#if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK
-  ticks = (msec + (MSEC_PER_TICK - 1)) / MSEC_PER_TICK;
-#else
-  ticks = ((clock_t)msec * USEC_PER_MSEC + (USEC_PER_TICK - 1)) /
-           USEC_PER_TICK;
-#endif
+  ticks = MSEC2TICK(msec);
 
   /* The time that we started the wait */
 
diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c
index c6d429d189d..cba73983baa 100644
--- a/fs/vfs/fs_poll.c
+++ b/fs/vfs/fs_poll.c
@@ -488,7 +488,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
            * will return immediately.
            */
 
-          ret = nxsem_tickwait(&sem, MSEC2TICK((clock_t)timeout));
+          ret = nxsem_tickwait(&sem, MSEC2TICK(timeout));
           if (ret < 0)
             {
               if (ret == -ETIMEDOUT)
diff --git a/fs/vfs/fs_timerfd.c b/fs/vfs/fs_timerfd.c
index aa2bc97fde1..cd06f2634f9 100644
--- a/fs/vfs/fs_timerfd.c
+++ b/fs/vfs/fs_timerfd.c
@@ -654,7 +654,7 @@ int timerfd_settime(int fd, int flags,
    * instead (assuming a repetitive timer).
    */
 
-  if ((sclock_t)delay <= 0)
+  if (delay <= 0)
     {
       delay = dev->delay;
     }
@@ -692,7 +692,7 @@ int timerfd_gettime(int fd, FAR struct itimerspec 
*curr_value)
 {
   FAR struct timerfd_priv_s *dev;
   FAR struct file *filep;
-  sclock_t ticks;
+  clock_t ticks;
   int ret;
 
   /* Some sanity checks */
diff --git a/include/limits.h b/include/limits.h
index df58833c20a..047dc3d6b85 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -236,7 +236,7 @@
 #define TIMER_MAX      _POSIX_TIMER_MAX
 #define CLOCKRES_MIN   _POSIX_CLOCKRES_MIN
 
-#define CLOCK_MAX      UINT64_MAX
+#define CLOCK_MAX      INT64_MAX
 
 /* Other invariant values */
 
diff --git a/include/nuttx/clock.h b/include/nuttx/clock.h
index f55b341ca60..fd7e14e6a91 100644
--- a/include/nuttx/clock.h
+++ b/include/nuttx/clock.h
@@ -177,11 +177,11 @@
 
 /* ?SEC2TIC rounds up */
 
-#define NSEC2TICK(nsec)       div_const_roundup(nsec, (uint32_t)NSEC_PER_TICK)
-#define USEC2TICK(usec)       div_const_roundup(usec, (uint32_t)USEC_PER_TICK)
+#define NSEC2TICK(nsec)       div_const_roundup(nsec, NSEC_PER_TICK)
+#define USEC2TICK(usec)       div_const_roundup(usec, USEC_PER_TICK)
 
 #if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK
-#  define MSEC2TICK(msec)     div_const_roundup(msec, (uint32_t)MSEC_PER_TICK)
+#  define MSEC2TICK(msec)     div_const_roundup(msec, MSEC_PER_TICK)
 #else
 #  define MSEC2TICK(msec)     USEC2TICK((msec) * USEC_PER_MSEC)
 #endif
@@ -196,34 +196,34 @@
 #if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK
 #  define TICK2MSEC(tick)     ((tick) * MSEC_PER_TICK)
 #else
-#  define TICK2MSEC(tick)     div_const(((tick) * USEC_PER_TICK), 
(uint32_t)USEC_PER_MSEC)
+#  define TICK2MSEC(tick)     div_const(((tick) * USEC_PER_TICK), 
USEC_PER_MSEC)
 #endif
 
 /* TIC2?SEC rounds to nearest */
 
-#define TICK2DSEC(tick)       div_const_roundnearest(tick, 
(uint32_t)TICK_PER_DSEC)
-#define TICK2HSEC(tick)       div_const_roundnearest(tick, 
(uint32_t)TICK_PER_HSEC)
-#define TICK2SEC(tick)        div_const_roundnearest(tick, 
(uint32_t)TICK_PER_SEC)
+#define TICK2DSEC(tick)       div_const_roundnearest(tick, TICK_PER_DSEC)
+#define TICK2HSEC(tick)       div_const_roundnearest(tick, TICK_PER_HSEC)
+#define TICK2SEC(tick)        div_const_roundnearest(tick, TICK_PER_SEC)
 
 /* MSEC2SEC */
 
-#define MSEC2SEC(usec)        div_const(msec, (uint32_t)MSEC_PER_SEC)
+#define MSEC2SEC(msec)        div_const(msec, MSEC_PER_SEC)
 
 /* USEC2MSEC */
 
-#define USEC2MSEC(usec)       div_const(usec, (uint32_t)USEC_PER_MSEC)
+#define USEC2MSEC(usec)       div_const(usec, USEC_PER_MSEC)
 
 /* USEC2SEC */
 
-#define USEC2SEC(usec)        div_const(usec, (uint32_t)USEC_PER_SEC)
+#define USEC2SEC(usec)        div_const(usec, USEC_PER_SEC)
 
 /* NSEC2USEC */
 
-#define NSEC2USEC(nsec)       div_const(nsec, (uint32_t)NSEC_PER_USEC)
+#define NSEC2USEC(nsec)       div_const(nsec, NSEC_PER_USEC)
 
 /* NSEC2MSEC */
 
-#define NSEC2MSEC(nsec)       div_const(nsec, (uint32_t)NSEC_PER_MSEC)
+#define NSEC2MSEC(nsec)       div_const(nsec, NSEC_PER_MSEC)
 
 #if defined(CONFIG_DEBUG_SCHED) && !defined(CONFIG_SCHED_TICKLESS)
 /* Initial system timer ticks value close to maximum 32-bit value, to test
@@ -232,7 +232,7 @@
  */
 
 #  define INITIAL_SYSTEM_TIMER_TICKS \
-    ((uint64_t)(UINT32_MAX - (TICK_PER_SEC * 5)))
+    (UINT32_MAX - (TICK_PER_SEC * 5))
 #else
 #  define INITIAL_SYSTEM_TIMER_TICKS 0
 #endif
@@ -301,13 +301,6 @@ struct cpuload_s
 };
 #endif
 
-/* This non-standard type used to hold relative clock ticks that may take
- * negative values.  Because of its non-portable nature the type sclock_t
- * should be used only within the OS proper and not by portable applications.
- */
-
-typedef int64_t sclock_t;
-
 /****************************************************************************
  * Public Data
  ****************************************************************************/
@@ -327,47 +320,47 @@ extern "C"
 #define clock_ticks2time(ts, tick) \
   do \
     { \
-      clock_t _tick = tick; \
-      (ts)->tv_sec = (time_t)div_const(_tick, (uint32_t)TICK_PER_SEC); \
-      _tick -= (clock_t)((ts)->tv_sec * TICK_PER_SEC); \
-      (ts)->tv_nsec = (long)_tick * NSEC_PER_TICK; \
+      clock_t _tick = (tick); \
+      (ts)->tv_sec = div_const(_tick, TICK_PER_SEC); \
+      _tick -= (ts)->tv_sec * TICK_PER_SEC; \
+      (ts)->tv_nsec = _tick * NSEC_PER_TICK; \
     } \
   while (0)
 
 #define clock_time2ticks(ts) \
-  ((clock_t)((ts)->tv_sec * TICK_PER_SEC) + \
-   (clock_t)div_const_roundup((uint64_t)(ts)->tv_nsec, 
(uint32_t)NSEC_PER_TICK))
+  ((ts)->tv_sec * TICK_PER_SEC + \
+   div_const_roundup((ts)->tv_nsec, NSEC_PER_TICK))
 
 #define clock_time2ticks_floor(ts) \
-  ((clock_t)(ts)->tv_sec * TICK_PER_SEC + \
-   div_const((uint32_t)(ts)->tv_nsec, (uint32_t)NSEC_PER_TICK))
+  ((ts)->tv_sec * TICK_PER_SEC + \
+   div_const((ts)->tv_nsec, NSEC_PER_TICK))
 
 #define clock_usec2time(ts, usec) \
   do \
     { \
-      uint64_t _usec = (usec); \
-      (ts)->tv_sec = (time_t)div_const(_usec, (uint32_t)USEC_PER_SEC); \
-      _usec -= (uint64_t)(ts)->tv_sec * USEC_PER_SEC; \
-      (ts)->tv_nsec = (long)_usec * NSEC_PER_USEC; \
+      int64_t _usec = (usec); \
+      (ts)->tv_sec = div_const(_usec, USEC_PER_SEC); \
+      _usec -= (ts)->tv_sec * USEC_PER_SEC; \
+      (ts)->tv_nsec = _usec * NSEC_PER_USEC; \
     } \
   while (0)
 
 #define clock_time2usec(ts) \
-  ((uint64_t)(ts)->tv_sec * USEC_PER_SEC + \
-   div_const((uint32_t)(ts)->tv_nsec, (uint32_t)NSEC_PER_USEC))
+  ((ts)->tv_sec * USEC_PER_SEC + \
+   div_const((ts)->tv_nsec, NSEC_PER_USEC))
 
 #define clock_nsec2time(ts, nsec) \
   do \
     { \
-      uint64_t _nsec = (nsec); \
-      (ts)->tv_sec = (time_t)div_const(_nsec, (uint32_t)NSEC_PER_SEC); \
-      _nsec -= (uint64_t)(ts)->tv_sec * NSEC_PER_SEC; \
-      (ts)->tv_nsec = (long)_nsec; \
+      int64_t _nsec = (nsec); \
+      (ts)->tv_sec = div_const(_nsec, NSEC_PER_SEC); \
+      _nsec -= (ts)->tv_sec * NSEC_PER_SEC; \
+      (ts)->tv_nsec = _nsec; \
     } \
   while (0)
 
 #define clock_time2nsec(ts) \
-  ((uint64_t)(ts)->tv_sec * NSEC_PER_SEC + (uint64_t)(ts)->tv_nsec)
+  ((ts)->tv_sec * NSEC_PER_SEC + (ts)->tv_nsec)
 
 /* Calculate delay+1, forcing the delay into a range that we can handle.
  *
@@ -389,7 +382,7 @@ extern "C"
  * current_tick + 1, which is not enough for at least 1 tick.
  */
 
-#define clock_delay2abstick(delay) (clock_systime_ticks() + (delay) + 1u)
+#define clock_delay2abstick(delay) (clock_systime_ticks() + (delay) + 1)
 
 /****************************************************************************
  * Name:  clock_timespec_add
@@ -447,7 +440,7 @@ extern "C"
           _nsec += NSEC_PER_SEC; \
           _sec--; \
         } \
-      if ((sclock_t)_sec < 0) \
+      if (_sec < 0) \
         { \
           _sec = 0; \
           _nsec = 0; \
@@ -540,7 +533,7 @@ int clock_realtime2absticks(FAR const struct timespec 
*reltime,
  *   false         - Otherwise.
  *
  * Assumptions:
- *   The type of delay value should be sclock_t.
+ *   The type of delay value should be clock_t.
  *
  ****************************************************************************/
 
@@ -554,16 +547,16 @@ int clock_realtime2absticks(FAR const struct timespec 
*reltime,
  *         it is considered not expired.
  *
  * For bit-63 as the sign bit, we can simplify this to:
- * (sclock_t)(tick2 - tick1) >= 0.
+ * (clock_t)(tick2 - tick1) >= 0.
  *
  * However, this function requires an assumption to work correctly:
- * Assumes the timer delay time does not exceed SCLOCK_MAX (2^63 - 1).
+ * Assumes the timer delay time does not exceed CLOCK_MAX (2^63 - 1).
  *
- * The range of the delay data type sclock_t being
- * [- (SCLOCK_MAX + 1), SCLOCK_MAX] ensures this assumption holds.
+ * The range of the delay data type clock_t being
+ * [- (CLOCK_MAX + 1), CLOCK_MAX] ensures this assumption holds.
  */
 
-#define clock_compare(tick1, tick2) ((sclock_t)((tick2) - (tick1)) >= 0)
+#define clock_compare(tick1, tick2) ((clock_t)((tick2) - (tick1)) >= 0)
 
 /****************************************************************************
  * Name:  clock_isleapyear
diff --git a/include/nuttx/fs/hostfs.h b/include/nuttx/fs/hostfs.h
index fba49f3efbf..92c611e8b03 100644
--- a/include/nuttx/fs/hostfs.h
+++ b/include/nuttx/fs/hostfs.h
@@ -136,7 +136,7 @@ typedef int          nuttx_fsid_t[2];
 
 /* These must match the definition in include/time.h */
 
-typedef uint64_t     nuttx_time_t;
+typedef int64_t      nuttx_time_t;
 
 struct nuttx_timespec
 {
diff --git a/include/nuttx/mqueue.h b/include/nuttx/mqueue.h
index 60f2ee96f25..02758bc9da3 100644
--- a/include/nuttx/mqueue.h
+++ b/include/nuttx/mqueue.h
@@ -634,7 +634,7 @@ int file_mq_timedsend(FAR struct file *mq, FAR const char 
*msg,
  ****************************************************************************/
 
 int file_mq_ticksend(FAR struct file *mq, FAR const char *msg,
-                     size_t msglen, unsigned int prio, sclock_t ticks);
+                     size_t msglen, unsigned int prio, clock_t ticks);
 
 /****************************************************************************
  * Name: file_mq_receive
@@ -740,7 +740,7 @@ ssize_t file_mq_timedreceive(FAR struct file *mq, FAR char 
*msg,
 
 ssize_t file_mq_tickreceive(FAR struct file *mq, FAR char *msg,
                             size_t msglen, FAR unsigned int *prio,
-                            sclock_t ticks);
+                            clock_t ticks);
 
 /****************************************************************************
  * Name:  file_mq_setattr
diff --git a/include/nuttx/timers/clkcnt.h b/include/nuttx/timers/clkcnt.h
index 31310b5ecba..e9ed6487936 100644
--- a/include/nuttx/timers/clkcnt.h
+++ b/include/nuttx/timers/clkcnt.h
@@ -128,7 +128,7 @@ clock_t clkcnt_max_tick(clkcnt_t max_count, uint32_t freq)
   clkcnt_t cnt = max_count / freq * TICK_PER_SEC +
                  max_count % freq * TICK_PER_SEC / freq;
   cnt = cnt <= CLOCK_MAX ? cnt : CLOCK_MAX;
-  return (clock_t)cnt;
+  return cnt;
 }
 
 /****************************************************************************
@@ -427,7 +427,7 @@ clock_t clkcnt_delta_cnt2tick(clkcnt_t delta, uint32_t freq)
 
   DEBUGASSERT(tick <= CLOCK_MAX);
 
-  return (clock_t)tick;
+  return tick;
 }
 
 /****************************************************************************
diff --git a/include/nuttx/wdog.h b/include/nuttx/wdog.h
index 8dab48c4851..ab9014c894d 100644
--- a/include/nuttx/wdog.h
+++ b/include/nuttx/wdog.h
@@ -188,7 +188,7 @@ int wd_start(FAR struct wdog_s *wdog, clock_t delay,
 
   /* Ensure delay is within the range the wdog can handle. */
 
-  if (delay <= WDOG_MAX_DELAY)
+  if (delay >= 0 && delay <= WDOG_MAX_DELAY)
     {
       ret = wd_start_abstick(wdog, clock_delay2abstick(delay), wdentry, arg);
     }
@@ -331,7 +331,7 @@ int wd_start_next(FAR struct wdog_s *wdog, clock_t delay,
 {
   /* Ensure delay is within the range the wdog can handle. */
 
-  if (delay > WDOG_MAX_DELAY)
+  if (delay < 0 || delay > WDOG_MAX_DELAY)
     {
       return -EINVAL;
     }
@@ -374,7 +374,7 @@ int wd_cancel(FAR struct wdog_s *wdog);
  *
  ****************************************************************************/
 
-sclock_t wd_gettime(FAR struct wdog_s *wdog);
+clock_t wd_gettime(FAR struct wdog_s *wdog);
 
 #undef EXTERN
 #ifdef __cplusplus
diff --git a/include/nuttx/wqueue.h b/include/nuttx/wqueue.h
index b38a8ce7ef7..0bda2d0acbe 100644
--- a/include/nuttx/wqueue.h
+++ b/include/nuttx/wqueue.h
@@ -547,7 +547,7 @@ int work_cancel_sync_wq(FAR struct kwork_wqueue_s *wqueue,
  *
  ****************************************************************************/
 
-#define work_timeleft(work) ((sclock_t)((work)->qtime - clock()))
+#define work_timeleft(work) ((work)->qtime - clock())
 
 /****************************************************************************
  * Name: lpwork_boostpriority
diff --git a/include/sys/types.h b/include/sys/types.h
index 93a62d167ed..0836db8feb3 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -247,12 +247,13 @@ typedef uint16_t     sa_family_t;
 /* Used for system times in clock ticks. This type is the natural width of
  * the system timer.
  *
- * NOTE: The signed-ness of clock_t is not specified at OpenGroup.org.  An
- * unsigned type is used to support the full range of the internal clock.
+ * NOTE: The signed-ness of clock_t is not specified at OpenGroup.org, but
+ * a signed type is used to align with other OSes (Linux, BSD, etc.) and
+ * to allow expressing negative tick differences directly.
  */
 
-typedef uint64_t     clock_t;
-typedef uint64_t     time_t;         /* Holds time in seconds */
+typedef int64_t      clock_t;
+typedef int64_t      time_t;         /* Holds time in seconds */
 typedef int          clockid_t;      /* Identifies one time base source */
 typedef FAR void    *timer_t;        /* Represents one POSIX timer */
 
diff --git a/libs/libc/netdb/lib_dnscache.c b/libs/libc/netdb/lib_dnscache.c
index 8212bbd86d0..d613ce4750c 100644
--- a/libs/libc/netdb/lib_dnscache.c
+++ b/libs/libc/netdb/lib_dnscache.c
@@ -145,7 +145,7 @@ void dns_save_answer(FAR const char *hostname,
   /* Get the current time */
 
   clock_gettime(CLOCK_MONOTONIC, &now);
-  entry->ctime = (time_t)now.tv_sec;
+  entry->ctime = now.tv_sec;
 #endif
 
   strlcpy(entry->name, hostname, CONFIG_NETDB_DNSCLIENT_NAMESIZE);
@@ -212,7 +212,7 @@ int dns_find_answer(FAR const char *hostname, FAR union 
dns_addr_u *addr,
   FAR struct dns_cache_s *entry;
 #if CONFIG_NETDB_DNSCLIENT_LIFESEC > 0
   struct timespec now;
-  uint32_t elapsed;
+  time_t elapsed;
   int ret;
 #endif
   int next;
@@ -243,12 +243,9 @@ int dns_find_answer(FAR const char *hostname, FAR union 
dns_addr_u *addr,
         }
 
 #if CONFIG_NETDB_DNSCLIENT_LIFESEC > 0
-      /* Check if this entry has expired
-       * REVISIT: Does not this calculation assume that the sizeof(time_t)
-       * is equal to the sizeof(uint32_t)?
-       */
+      /* Check if this entry has expired */
 
-      elapsed = (uint32_t)now.tv_sec - (uint32_t)entry->ctime;
+      elapsed = now.tv_sec - entry->ctime;
       if (ret >= 0 &&
           (elapsed > CONFIG_NETDB_DNSCLIENT_LIFESEC || elapsed > entry->ttl))
         {
diff --git a/libs/libc/time/lib_calendar2utc.c 
b/libs/libc/time/lib_calendar2utc.c
index 9b7180133dc..8d87c438c36 100644
--- a/libs/libc/time/lib_calendar2utc.c
+++ b/libs/libc/time/lib_calendar2utc.c
@@ -168,7 +168,7 @@ time_t clock_calendar2utc(int year, int month, int day)
 
   /* Add in the days up to the beginning of this month. */
 
-  days += (time_t)clock_daysbeforemonth(month, clock_isleapyear(year));
+  days += clock_daysbeforemonth(month, clock_isleapyear(year));
 
   /* Add in the days since the beginning of this month (days are 1-based). */
 
diff --git a/libs/libc/time/lib_time.c b/libs/libc/time/lib_time.c
index 67a3701c692..e73ca429222 100644
--- a/libs/libc/time/lib_time.c
+++ b/libs/libc/time/lib_time.c
@@ -80,5 +80,5 @@ time_t time(time_t *tloc)
       return ts.tv_sec;
     }
 
-  return (time_t)ERROR;
+  return ERROR;
 }
diff --git a/mm/iob/iob_alloc.c b/mm/iob/iob_alloc.c
index 130526bc49f..27575084c03 100644
--- a/mm/iob/iob_alloc.c
+++ b/mm/iob/iob_alloc.c
@@ -46,7 +46,7 @@
 
 static clock_t iob_allocwait_gettimeout(clock_t start, unsigned int timeout)
 {
-  sclock_t tick;
+  clock_t tick;
 
   tick = clock_systime_ticks() - start;
   if (tick >= MSEC2TICK(timeout))
diff --git a/net/icmp/icmp_pmtu.c b/net/icmp/icmp_pmtu.c
index 39e84bccb3e..2d8e0461abe 100644
--- a/net/icmp/icmp_pmtu.c
+++ b/net/icmp/icmp_pmtu.c
@@ -99,16 +99,16 @@ void icmpv4_add_pmtu_entry(in_addr_t destipaddr, int mtu)
 
   for (i = 0; i < CONFIG_NET_ICMP_PMTU_ENTRIES; i++)
     {
-      if ((g_icmp_pmtu_entry[i].pmtu == 0) ||
-          (sclock_t)(now - g_icmp_pmtu_entry[i].time) >=
+      if (g_icmp_pmtu_entry[i].pmtu == 0 ||
+          now - g_icmp_pmtu_entry[i].time >=
           SEC2TICK(CONFIG_NET_ICMP_PMTU_TIMEOUT * 60))
         {
           j = i;
           break;
         }
 
-      if ((sclock_t)(g_icmp_pmtu_entry[i].time -
-          g_icmp_pmtu_entry[j].time) < 0)
+      if (g_icmp_pmtu_entry[i].time -
+          g_icmp_pmtu_entry[j].time < 0)
         {
           j = i;
         }
diff --git a/net/icmpv6/icmpv6_pmtu.c b/net/icmpv6/icmpv6_pmtu.c
index 996d7a80183..11d06cdd391 100644
--- a/net/icmpv6/icmpv6_pmtu.c
+++ b/net/icmpv6/icmpv6_pmtu.c
@@ -99,15 +99,15 @@ void icmpv6_add_pmtu_entry(net_ipv6addr_t destipaddr, int 
mtu)
   for (i = 0; i < CONFIG_NET_ICMPv6_PMTU_ENTRIES; i++)
     {
       if (g_icmpv6_pmtu_entry[i].pmtu == 0 ||
-          (sclock_t)(now - g_icmpv6_pmtu_entry[i].time) >=
+          now - g_icmpv6_pmtu_entry[i].time >=
           SEC2TICK(CONFIG_NET_ICMPv6_PMTU_TIMEOUT * 60))
         {
           j = i;
           break;
         }
 
-      if ((sclock_t)(g_icmpv6_pmtu_entry[i].time -
-          g_icmpv6_pmtu_entry[j].time) < 0)
+      if (g_icmpv6_pmtu_entry[i].time -
+          g_icmpv6_pmtu_entry[j].time < 0)
         {
           j = i;
         }
diff --git a/net/ipfrag/ipfrag.c b/net/ipfrag/ipfrag.c
index ae87114199c..e4e47bc3bdc 100644
--- a/net/ipfrag/ipfrag.c
+++ b/net/ipfrag/ipfrag.c
@@ -192,7 +192,7 @@ static void ip_fragin_timerout_expiry(wdparm_t arg)
 static void ip_fragin_timerwork(FAR void *arg)
 {
   clock_t curtick = clock_systime_ticks();
-  sclock_t interval = 0;
+  clock_t interval = 0;
   FAR sq_entry_t *entry;
   FAR sq_entry_t *entrynext;
   FAR struct ip_fragsnode_s *node;
diff --git a/net/mld/mld_query.c b/net/mld/mld_query.c
index a7767153e34..e665a3a1761 100644
--- a/net/mld/mld_query.c
+++ b/net/mld/mld_query.c
@@ -88,46 +88,10 @@ static inline void mld_check_v1compat(FAR struct 
net_driver_s *dev,
        * running, this will reset the timer.
        */
 
-      mld_start_v1timer(dev,
-                    MSEC2TICK(MLD_V1PRESENT_MSEC((clock_t)MLD_QUERY_MSEC)));
+      mld_start_v1timer(dev, MSEC2TICK(MLD_V1PRESENT_MSEC(MLD_QUERY_MSEC)));
     }
 }
 
-/****************************************************************************
- * Name: mld_mrc2mrd
- *
- * Description:
- *  Convert the MLD Maximum Response Code (MRC) to the Maximum Response
- *  Delay (MRD) in units of system clock ticks.
- *
- ****************************************************************************/
-
-#if 0 /* Not used */
-static clock_t mld_mrc2mrd(uint16_t mrc)
-{
-  uint32_t mrd;  /* Units of milliseconds */
-
-  /* If bit 15 is not set (i.e., mrc < 32768),
-   * then no conversion is required.
-   */
-
-  if (mrc < 32768)
-    {
-      mrd = mrc;
-    }
-  else
-    {
-      /* Conversion required */
-
-      mrd = MLD_MRD_VALUE(mrc);
-    }
-
-  /* Return the MRD in units of clock ticks */
-
-  return MSEC2TICK((clock_t)mrd);
-}
-#endif
-
 /****************************************************************************
  * Name: mld_cmpaddr
  *
diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h
index 07aed8ee990..09d2fcddb76 100644
--- a/net/tcp/tcp.h
+++ b/net/tcp/tcp.h
@@ -278,7 +278,7 @@ struct tcp_conn_s
 #endif
   uint16_t flags;         /* Flags of TCP-specific options */
 #ifdef CONFIG_NET_SOLINGER
-  sclock_t ltimeout;      /* Linger timeout expiration */
+  clock_t ltimeout;       /* Linger timeout expiration */
 #endif
 #ifdef CONFIG_NETDEV_RSS
   int      rcvcpu;        /* Current cpu id */
diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c
index 44ded0aef90..96a35dd0ad6 100644
--- a/net/tcp/tcp_timer.c
+++ b/net/tcp/tcp_timer.c
@@ -233,7 +233,7 @@ static void tcp_xmit_probe(FAR struct net_driver_s *dev,
 
 void tcp_update_timer(FAR struct tcp_conn_s *conn)
 {
-  sclock_t timeout = tcp_get_timeout(conn);
+  clock_t timeout = tcp_get_timeout(conn);
 
   if (timeout > 0)
     {
@@ -242,7 +242,7 @@ void tcp_update_timer(FAR struct tcp_conn_s *conn)
 
       if (conn->ltimeout != 0)
         {
-          sclock_t ticks = conn->ltimeout - clock_systime_ticks();
+          clock_t ticks = conn->ltimeout - clock_systime_ticks();
 
           if (ticks <= 0)
             {
@@ -448,7 +448,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct 
tcp_conn_s *conn)
   /* Send reset immediately if linger timeout */
 
   if (conn->ltimeout != 0 &&
-      ((sclock_t)(conn->ltimeout - clock_systime_ticks()) <= 0))
+      conn->ltimeout - clock_systime_ticks() <= 0)
     {
       conn->tcpstateflags = TCP_CLOSED;
       ninfo("TCP state: TCP_CLOSED\n");
diff --git a/net/utils/net_snoop.c b/net/utils/net_snoop.c
index 16e1a8f1547..9baf111c6e8 100644
--- a/net/utils/net_snoop.c
+++ b/net/utils/net_snoop.c
@@ -47,7 +47,7 @@
 
 /* microseconds since midnight, January 1st, 0 AD nominal Gregorian. */
 
-#define SNOOP_EPOCH_USEC(tv) (((tv).tv_sec - 0x386d4380ll) * 1000000ll \
+#define SNOOP_EPOCH_USEC(tv) (((tv).tv_sec - 0x386d4380) * 1000000 \
                               + (tv).tv_usec + 0x00e03ab44a676000ll)
 
 /****************************************************************************
diff --git a/sched/clock/clock.c b/sched/clock/clock.c
index 8f1c20f415e..5d3d478049a 100644
--- a/sched/clock/clock.c
+++ b/sched/clock/clock.c
@@ -54,13 +54,11 @@
  *   None
  *
  * Returned Value:
- *   The system time in units of clock ticks is returned.  If the processor
- *   time used is not available or its value cannot be represented, the
- *   function will return the value (clock_t)-1.
+ *   The system time in units of clock ticks is returned.
  *
  ****************************************************************************/
 
 clock_t clock(void)
 {
-  return (clock_t)clock_systime_ticks();
+  return clock_systime_ticks();
 }
diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c
index 98df8a0dbd7..117929a4177 100644
--- a/sched/clock/clock_initialize.c
+++ b/sched/clock/clock_initialize.c
@@ -137,7 +137,7 @@ int clock_basetime(FAR struct timespec *tp)
 
   /* Set the base time as seconds into this julian day. */
 
-  tp->tv_sec  = jdn * (time_t)SEC_PER_DAY;
+  tp->tv_sec  = jdn * SEC_PER_DAY;
   tp->tv_nsec = 0;
   return OK;
 }
diff --git a/sched/mqueue/mq_rcvinternal.c b/sched/mqueue/mq_rcvinternal.c
index db8dfbbc76b..dd3c6c42003 100644
--- a/sched/mqueue/mq_rcvinternal.c
+++ b/sched/mqueue/mq_rcvinternal.c
@@ -127,7 +127,7 @@ static void nxmq_rcvtimeout(wdparm_t arg)
 int nxmq_wait_receive(FAR struct mqueue_inode_s *msgq,
                       FAR struct mqueue_msg_s **rcvmsg,
                       FAR const struct timespec *abstime,
-                      sclock_t ticks)
+                      clock_t ticks)
 {
   FAR struct mqueue_msg_s *newmsg;
   FAR struct tcb_s *rtcb = this_task();
diff --git a/sched/mqueue/mq_receive.c b/sched/mqueue/mq_receive.c
index 8e39036c01b..3703d204474 100644
--- a/sched/mqueue/mq_receive.c
+++ b/sched/mqueue/mq_receive.c
@@ -138,7 +138,7 @@ static
 ssize_t file_mq_timedreceive_internal(FAR struct file *mq, FAR char *msg,
                                       size_t msglen, FAR unsigned int *prio,
                                       FAR const struct timespec *abstime,
-                                      sclock_t ticks)
+                                      clock_t ticks)
 {
   FAR struct mqueue_inode_s *msgq;
   FAR struct mqueue_msg_s *mqmsg;
@@ -325,7 +325,7 @@ ssize_t file_mq_timedreceive(FAR struct file *mq, FAR char 
*msg,
 
 ssize_t file_mq_tickreceive(FAR struct file *mq, FAR char *msg,
                             size_t msglen, FAR unsigned int *prio,
-                            sclock_t ticks)
+                            clock_t ticks)
 {
   return file_mq_timedreceive_internal(mq, msg, msglen, prio, NULL, ticks);
 }
diff --git a/sched/mqueue/mq_send.c b/sched/mqueue/mq_send.c
index a6671e15bf8..a4d3ba36c5e 100644
--- a/sched/mqueue/mq_send.c
+++ b/sched/mqueue/mq_send.c
@@ -275,7 +275,7 @@ static
 int file_mq_timedsend_internal(FAR struct file *mq, FAR const char *msg,
                                size_t msglen, unsigned int prio,
                                FAR const struct timespec *abstime,
-                               sclock_t ticks)
+                               clock_t ticks)
 {
   FAR struct mqueue_inode_s *msgq;
   FAR struct mqueue_msg_s *mqmsg;
@@ -466,7 +466,7 @@ int file_mq_timedsend(FAR struct file *mq, FAR const char 
*msg,
  ****************************************************************************/
 
 int file_mq_ticksend(FAR struct file *mq, FAR const char *msg,
-                     size_t msglen, unsigned int prio, sclock_t ticks)
+                     size_t msglen, unsigned int prio, clock_t ticks)
 {
   return file_mq_timedsend_internal(mq, msg, msglen, prio, NULL, ticks);
 }
diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c
index a9e2b8956e1..ac7bfe12e57 100644
--- a/sched/mqueue/mq_sndinternal.c
+++ b/sched/mqueue/mq_sndinternal.c
@@ -126,7 +126,7 @@ static void nxmq_sndtimeout(wdparm_t arg)
 
 int nxmq_wait_send(FAR struct mqueue_inode_s *msgq,
                    FAR const struct timespec *abstime,
-                   sclock_t ticks)
+                   clock_t ticks)
 {
   FAR struct tcb_s *rtcb = this_task();
 
diff --git a/sched/mqueue/mqueue.h b/sched/mqueue/mqueue.h
index 9499e155e25..27aa681319b 100644
--- a/sched/mqueue/mqueue.h
+++ b/sched/mqueue/mqueue.h
@@ -128,14 +128,14 @@ void nxmq_wait_irq(FAR struct tcb_s *wtcb, int errcode);
 int nxmq_wait_receive(FAR struct mqueue_inode_s *msgq,
                       FAR struct mqueue_msg_s **rcvmsg,
                       FAR const struct timespec *abstime,
-                      sclock_t ticks);
+                      clock_t ticks);
 void nxmq_notify_receive(FAR struct mqueue_inode_s *msgq);
 
 /* mq_sndinternal.c *********************************************************/
 
 int nxmq_wait_send(FAR struct mqueue_inode_s *msgq,
                    FAR const struct timespec *abstime,
-                   sclock_t ticks);
+                   clock_t ticks);
 void nxmq_notify_send(FAR struct mqueue_inode_s *msgq);
 
 /* mq_recover.c *************************************************************/
diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c
index cbbd6075f33..19b43f85895 100644
--- a/sched/pthread/pthread_create.c
+++ b/sched/pthread/pthread_create.c
@@ -328,8 +328,8 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR 
pthread_t *thread,
   if (policy == SCHED_SPORADIC)
     {
       FAR struct sporadic_s *sporadic;
-      sclock_t repl_ticks;
-      sclock_t budget_ticks;
+      clock_t repl_ticks;
+      clock_t budget_ticks;
 
       /* Convert timespec values to system clock ticks */
 
diff --git a/sched/sched/sched_profil.c b/sched/sched/sched_profil.c
index 585c5b24275..cdd77a875a4 100644
--- a/sched/sched/sched_profil.c
+++ b/sched/sched/sched_profil.c
@@ -34,7 +34,7 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define PROFTICK NSEC2TICK((clock_t)(NSEC_PER_SEC / 
CONFIG_SCHED_PROFILE_TICKSPERSEC))
+#define PROFTICK NSEC2TICK(NSEC_PER_SEC / CONFIG_SCHED_PROFILE_TICKSPERSEC)
 
 /****************************************************************************
  * Private Types
diff --git a/sched/sched/sched_setparam.c b/sched/sched/sched_setparam.c
index 4e8a5b7626d..586ad7463cc 100644
--- a/sched/sched/sched_setparam.c
+++ b/sched/sched/sched_setparam.c
@@ -55,8 +55,8 @@ int set_sporadic_param(FAR const struct sched_param *param,
   if ((rtcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_SPORADIC)
     {
       FAR struct sporadic_s *sporadic;
-      sclock_t repl_ticks;
-      sclock_t budget_ticks;
+      clock_t repl_ticks;
+      clock_t budget_ticks;
 
       if (param->sched_ss_max_repl >= 1 &&
           param->sched_ss_max_repl <= CONFIG_SCHED_SPORADIC_MAXREPL)
diff --git a/sched/sched/sched_setscheduler.c b/sched/sched/sched_setscheduler.c
index 4936c2e5eed..4efe6684b6f 100644
--- a/sched/sched/sched_setscheduler.c
+++ b/sched/sched/sched_setscheduler.c
@@ -49,8 +49,8 @@ int process_sporadic(FAR struct tcb_s *tcb,
                      FAR const struct sched_param *param)
 {
   FAR struct sporadic_s *sporadic;
-  sclock_t repl_ticks;
-  sclock_t budget_ticks;
+  clock_t repl_ticks;
+  clock_t budget_ticks;
   int ret = -EINVAL;
 
   if (param->sched_ss_max_repl >= 1 &&
diff --git a/sched/timer/timer_gettime.c b/sched/timer/timer_gettime.c
index 280c656d13d..75a25b6291c 100644
--- a/sched/timer/timer_gettime.c
+++ b/sched/timer/timer_gettime.c
@@ -73,7 +73,7 @@
 int timer_gettime(timer_t timerid, FAR struct itimerspec *value)
 {
   FAR struct posix_timer_s *timer = timer_gethandle(timerid);
-  sclock_t ticks;
+  clock_t ticks;
   int ret = OK;
 
   if (!timer || !value)
diff --git a/sched/wdog/wd_gettime.c b/sched/wdog/wd_gettime.c
index 5ebdcfc3c4a..8fe8e49a591 100644
--- a/sched/wdog/wd_gettime.c
+++ b/sched/wdog/wd_gettime.c
@@ -52,12 +52,12 @@
  *
  ****************************************************************************/
 
-sclock_t wd_gettime(FAR struct wdog_s *wdog)
+clock_t wd_gettime(FAR struct wdog_s *wdog)
 {
   irqstate_t flags;
   clock_t    expired;
   bool       is_active;
-  sclock_t   delay = 0;
+  clock_t    delay = 0;
 
   if (wdog != NULL && WDOG_ISACTIVE(wdog))
     {
@@ -68,7 +68,7 @@ sclock_t wd_gettime(FAR struct wdog_s *wdog)
 
       if (is_active)
         {
-          delay = (sclock_t)(expired - clock_systime_ticks());
+          delay = expired - clock_systime_ticks();
           delay = delay >= 0 ? delay : 0;
         }
     }
diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c
index 55ee857c467..36939523054 100644
--- a/sched/wdog/wd_start.c
+++ b/sched/wdog/wd_start.c
@@ -368,7 +368,7 @@ uint64_t wd_timer(const hrtimer_t *timer, uint64_t expired)
 
   clock_t  tick = div_const(expired, NSEC_PER_TICK);
   clock_t delay = wd_expiration(tick) - tick;
-  uint64_t nsec = TICK2NSEC((uint64_t)delay);
+  uint64_t nsec = TICK2NSEC(delay);
   return nsec <= HRTIMER_MAX_DELAY ? nsec : HRTIMER_MAX_DELAY;
 }
 #endif
diff --git a/sched/wdog/wdog.h b/sched/wdog/wdog.h
index 8303e6bb35a..bd726af57d7 100644
--- a/sched/wdog/wdog.h
+++ b/sched/wdog/wdog.h
@@ -127,11 +127,11 @@ uint64_t wd_timer(const hrtimer_t *timer, uint64_t 
expired);
 #ifdef CONFIG_HRTIMER
 static inline_function void wd_timer_start(clock_t tick, bool in_expiration)
 {
-  DEBUGASSERT((uint64_t)tick <= UINT64_MAX / NSEC_PER_TICK);
+  DEBUGASSERT(tick <= INT64_MAX / NSEC_PER_TICK);
   if (!in_expiration)
     {
       hrtimer_start(&g_wdtimer, wd_timer,
-                    TICK2NSEC((uint64_t)tick), HRTIMER_MODE_ABS);
+                    TICK2NSEC(tick), HRTIMER_MODE_ABS);
     }
 }
 
@@ -214,7 +214,7 @@ static inline_function clock_t wd_get_next_expire(clock_t 
curr)
     }
 
   leave_critical_section(flags);
-  return (sclock_t)(next - curr) <= 0 ? 0u : next;
+  return next - curr <= 0 ? 0 : next;
 }
 
 #undef EXTERN

Reply via email to