Re: Timeout timers in an application



David Schwartz <davids@xxxxxxxxxxxxx> writes:
On Jan 18, 9:27 am, "Ed J" <j...@xxxxxxxxxxx> wrote:
How can I implement a timeout timer in an application such that it wouldn't
be subject to a time-of-day clock adjustment? My current implementation
uses time(), etc., but since they are based on the time-of-day clock, my
code breaks if the system clock is set or adjusted while a timeout is
pending.

[...]

Generally, if you want to set a timer for 15 seconds from now,
you track that as being when the system uptime is 15 seconds more
than it was when the timer was set.

The kernel already does that for everybody who may need this. The
interfaces would be alarm or setitimer for higher resolutions.
.



Relevant Pages

  • Timeout timers in an application
    ... How can I implement a timeout timer in an application such that it wouldn't ... be subject to a time-of-day clock adjustment? ... uses time, etc., but since they are based on the time-of-day clock, my ... or is there another bullet-proof solution for user space ...
    (comp.os.linux.development.apps)
  • Re: Timeout timers in an application
    ... be subject to a time-of-day clock adjustment? ... My current implementation uses time, etc., but since they are based on the time-of-day clock, my code breaks if the system clock is set or adjusted while a timeout is pending. ... There are better things in life than alcohol, but alcohol makes up for not having them. ...
    (comp.os.linux.development.apps)