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 16647d053cb5fb2ec25481f971c314e9821410c6
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 23 10:49:23 2026 +0200

    fs/procfs, arch/arm/rtl8720c: Use clock_systime_ticks() for tick values.
    
    The critical section monitor in procfs and rtw_get_current_time() of the
    AmebaZ driver took the value of clock() as a number of system ticks.
    clock() counts in CLOCKS_PER_SEC units, which is the tick rate today.
    In the kernel the tick counter is clock_systime_ticks(), which clock()
    returns.
    
    Use clock_systime_ticks().  The values do not change.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 arch/arm/src/rtl8720c/amebaz_depend.c | 2 +-
 fs/procfs/fs_procfscritmon.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/rtl8720c/amebaz_depend.c 
b/arch/arm/src/rtl8720c/amebaz_depend.c
index b65cc1a598e..916b4c751cb 100644
--- a/arch/arm/src/rtl8720c/amebaz_depend.c
+++ b/arch/arm/src/rtl8720c/amebaz_depend.c
@@ -372,7 +372,7 @@ int rtw_deinit_xqueue(void **queue)
 
 uint32_t rtw_get_current_time(void)
 {
-  return clock();
+  return clock_systime_ticks();
 }
 
 uint32_t rtw_systime_to_ms(uint32_t systime)
diff --git a/fs/procfs/fs_procfscritmon.c b/fs/procfs/fs_procfscritmon.c
index 599c1fcdc18..9fb12a374fc 100644
--- a/fs/procfs/fs_procfscritmon.c
+++ b/fs/procfs/fs_procfscritmon.c
@@ -329,7 +329,7 @@ static ssize_t critmon_read_cpu(FAR struct critmon_file_s 
*attr,
       all_time.tv_nsec = 0;
     }
 
-  elapsed = clock() * CONFIG_USEC_PER_TICK;
+  elapsed = clock_systime_ticks() * CONFIG_USEC_PER_TICK;
   rate = (all_time.tv_sec * 1000000 + all_time.tv_nsec / 1000) *
          1000000 / elapsed;
 

Reply via email to