michallenc commented on PR #18816:
URL: https://github.com/apache/nuttx/pull/18816#issuecomment-4336766825

   > Seems fine! Would this cause issues with getting the clock time after the 
set though? Where the caller might expect the time to be set correctly once the 
caller returns?
   > 
   > Can this issue be fixed by performing the call in a worker thread at the 
application level, instead of in the kernel?
   
   You still get the correct time after the set, because the read with 
`clock_gettime` is performed from system clock, not from RTC. The user won't 
have the confirmation the write to RTC was done, but he can't rely on it now 
neither as we don't handle possible error from `up_rtc_settime` - we can't, it 
would violate POSIX interface of `clock_settime`. So even now successful 
`clock_settime` doesn't mean RTC was written.
   
   The entire RTC clock setting is unfortunately not standardized and platform 
specific. Linux for example has a specific IOCTL or you can configure periodic 
writes to RTC if I remember it correctly, but it doesn't change it on 
`clock_settime`.
   
   It can be fixed at the application level, but that is fixing the kernel 
problem from the app instead of fixing it in the kernel. And I think this is 
kernel issue because `clock_settime` shouldn't block. I am ok with adding new 
config option that would not make the proposed behavior default but only if 
user selects it if you prefer.


-- 
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