hartmannathan commented on pull request #1005:
URL: 
https://github.com/apache/incubator-nuttx-apps/pull/1005#issuecomment-1040526737


   > @xiaoxiang781216 what happened to CLOCK_REALTIME? If I'm not wrong 
CLOCK_REALTIME is affected when you change the time/date and CLOCK_MONOTONIC is 
not. Isn't going break some application and/or Linux/POSIX compatibility? For 
measuring elapsed time in fact CLOCK_MONOTONIC is the solution, but I guess 
there are cases where CLOCK_REALTIME could be useful. More info: 
https://stackoverflow.com/questions/3523442/difference-between-clock-realtime-and-clock-monotonic
 
http://www.qnx.com/developers/docs/qnxcar2/index.jsp?topic=%2Fcom.qnx.doc.neutrino.getting_started%2Ftopic%2Fs1_timer_CLOCK_MONOTONIC.html
 
https://tagmerge.com/question/difference-between-clock_realtime-and-clock_monotonic?answer=61e1f9684f0d313df01d4719
   
   CLOCK_REALTIME can go "backwards" due to clock changes, daylight saving 
time, leap seconds, NTP, and other reasons. For measuring elapsed time you 
definitely want CLOCK_MONOTONIC.
   
   From memory, I think both clocks are present in POSIX at minimum; then there 
are other clocks like, e.g., CLOCK_BOOTTIME that are not guaranteed to be 
present.


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to