Subj : Re: usage of time() for timeout handling To : comp.arch.embedded,comp.programming From : Willem Date : Wed Jul 27 2005 10:49 pm David wrote: ) Hi gurus, ) I'm having some modules, that use time() for determine if a given activity ) has timed out. As the operating system time will be updated periodically ) with the time or the RTC chip, it is possible that the result of two calls A good operating system will not 'jump' the OS clock to the correct time, it will slow down or speed up the OS clock so that it will match the correct timeafter a while. (Unless the jump is too great, in which case it will do it at once, but with a warning in a log file of some sort.) ) to time() would give a smaller value on the second call. This would cause ) the timeout calculation to fail and result in unexpected behaviour. ) This situation could specially occour if the user changed the time of the ) system! How are you handling this problem? On could use the system tick for ) timeout calculations. But somewhere I read that for acuracy reason you ) should not do this for longer timeouts. How do you handle this problem? There are usually system calls that return different clocks that do not suffer from this problem, because they aren't synchronized with world time. SaSW, Willem -- Disclaimer: I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged or something.. No I'm not paranoid. You all think I'm paranoid, don't you ! #EOT .