pkarashchenko commented on a change in pull request #5503:
URL: https://github.com/apache/incubator-nuttx/pull/5503#discussion_r808776699



##########
File path: arch/arm/src/lc823450/lc823450_rtc.c
##########
@@ -550,10 +548,8 @@ int up_rtc_settime(FAR const struct timespec *ts)
   up_rtc_set_default_datetime(tp);
 #endif /* CONFIG_RTC_SAVE_DEFAULT */
 
-#ifdef CONFIG_CLOCK_MONOTONIC
-  clock_gettime(CLOCK_MONOTONIC, &lastupdate_mono);
+  clock_systime_timespec(&lastupdate_mono);

Review comment:
       I think we should rename `lastupdate_mono` probably to 
`lastupdate_systime` since `clock_gettime(CLOCK_MONOTONIC,...)` is not used 
here anymore

##########
File path: arch/arm/src/stm32f7/stm32_bbsram.c
##########
@@ -317,7 +317,7 @@ static int stm32_bbsram_open(FAR struct file *filep)
 static int stm32_bbsram_internal_close(FAR struct bbsramfh_s *bbf)
 {
   bbf->dirty = 0;
-  clock_gettime(CLOCK_REALTIME, &bbf->lastwrite);
+  clock_systime_timespec(&bbf->lastwrite);

Review comment:
       There is a code in board files
   ```
         syslog(LOG_EMERG, "There is a hard fault logged.\n");
         state = (desc.lastwrite.tv_sec || desc.lastwrite.tv_nsec) ?  OK : 1;
   
         syslog(LOG_INFO, "Fault Log info File No %d Length %d flags:0x%02x "
             "state:%d\n", (unsigned int)desc.fileno, (unsigned int) desc.len,
             (unsigned int)desc.flags, state);
   
         if (state == OK)
           {
             time_sec = desc.lastwrite.tv_sec + (desc.lastwrite.tv_nsec / 1e9);
             gmtime_r(&time_sec, &tt);
             strftime(buf, HEADER_TIME_FMT_LEN , HEADER_TIME_FMT , &tt);
   
             syslog(LOG_INFO, "Fault Logged on %s - Valid\n", buf);
           }
   ```
   that reassembles string time stamp with `gmtime_r`. So in case if 
`CONFIG_CLOCK_TIMEKEEPING=y` the `clock_gettime` may be
   ```
   #if defined(CONFIG_CLOCK_TIMEKEEPING)
         ret = clock_timekeeping_get_wall_time(tp);
   #else
         ret = clock_systime_timespec(&ts);
   ```
   So I think we should keep `clock_gettime(CLOCK_REALTIME, &bbf->lastwrite);` 
here and in similar places




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to