Subj : Re: usage of time() for timeout handling To : comp.arch.embedded,comp.programming From : Ed Prochak Date : Thu Jul 28 2005 03:22 pm and worrying about changing clock settings isn't a problem? the other solutions all proposed some workaround to calling time(). They all suffer the reversed clock problem (except for Dan). The OP asked about timeout and specifically mentioned resolutions on level of whole seconds. (he's currentlly calling the time() function.) He made no explicit mention of needing more than one timeout. But if he does, then he just needs some cooperation between the different timeouts. It would be easy to set up shared functions that allow him to: create a timeout cancel a timeout start a timeout for a given number of seconds with a SIGALARM handler function that uses the data created by those functions to provide multiple timeouts. IF he needs this he should be able to program it. This isn't a difficult thing. Not much more work than what you would do with start/stop values. He could put all these functions in another small module. And yes it is possible to send a SIGALRM from something other than the alarm(). (And you better read all of the alarm() manpage for other side effects.) But the point is the system clock can be changed all they want, his code will not be effected. And I presented a function that doesn't have that problem. So unless there is a special function in his OS/language for this, I think alarm() is the best choice. Ed .