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

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


The following commit(s) were added to refs/heads/master by this push:
     new dde8eeae5df arch/cxd56xx: Arrange the date for Sony Spresense
dde8eeae5df is described below

commit dde8eeae5dfdb7783df6211202f8b3e61daafe37
Author: Jean-Frederic Clere <[email protected]>
AuthorDate: Mon Oct 26 17:58:36 2026 +0100

    arch/cxd56xx: Arrange the date for Sony Spresense
    
    Setting time/date using the date command was saving a wrong date.
    
    Signed-off-by: Jean-Frederic Clere <[email protected]>Arrange the date.
---
 arch/arm/src/cxd56xx/cxd56_rtc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_rtc.c b/arch/arm/src/cxd56xx/cxd56_rtc.c
index b83b8b1bcc0..b21708383a3 100644
--- a/arch/arm/src/cxd56xx/cxd56_rtc.c
+++ b/arch/arm/src/cxd56xx/cxd56_rtc.c
@@ -337,9 +337,10 @@ static void cxd56_rtc_initialize(wdparm_t arg)
 
 static void cxd56_update_basetime(struct timespec *tp)
 {
-  tp->tv_sec  = g_rtc_save->offset / CONFIG_RTC_FREQUENCY;
-  tp->tv_nsec = (g_rtc_save->offset % CONFIG_RTC_FREQUENCY) *
-                (NSEC_PER_SEC / CONFIG_RTC_FREQUENCY);
+  int64_t offset = g_rtc_save->offset;
+
+  tp->tv_sec  = (time_t)(offset >> 15);
+  tp->tv_nsec = (long)(((offset & 0x7fff) * NSEC_PER_SEC) >> 15);
 }
 
 /****************************************************************************
@@ -392,9 +393,8 @@ time_t up_rtc_time(void)
 
   count = cxd56_rtc_count();
   count += g_rtc_save->offset;
-  count >>= 15; /* convert to 1sec resolution */
 
-  return count / CONFIG_RTC_FREQUENCY;
+  return (time_t)(count >> 15);
 }
 #endif
 

Reply via email to