From owner-freebsd-hackers  Fri May 10 01:28:03 1996
Return-Path: owner-hackers
Received: (from root@localhost)
          by freefall.freebsd.org (8.7.3/8.7.3) id BAA02652
          for hackers-outgoing; Fri, 10 May 1996 01:28:03 -0700 (PDT)
Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19])
          by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id BAA02631
          for <freebsd-hackers@FreeBSD.org>; Fri, 10 May 1996 01:27:53 -0700 (PDT)
Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id SAA03647; Fri, 10 May 1996 18:20:25 +1000
Date: Fri, 10 May 1996 18:20:25 +1000
From: Bruce Evans <bde@zeta.org.au>
Message-Id: <199605100820.SAA03647@godzilla.zeta.org.au>
To: freebsd-hackers@FreeBSD.org, mihoko@pa.yokogawa.co.jp
Subject: Re: a problem of setitimer()
Cc: taketomi@pa.yokogawa.co.jp
Sender: owner-hackers@FreeBSD.org
X-Loop: FreeBSD.org
Precedence: bulk

>I'm running FreeBSD-2.1.0R.

>I found the problem of realitexpire() [sys/kern/kern_time.c].

>If the time is late, the process which uses the system call
>setitimer() can't get SIGALARM until the next timeout has come.

>For example, the current time is 7:30 and the next timeout is 7:32,
>then the time is changed to 7:15.
>The process gets SIGALARM at 7:32, not at 7:17.

>I suggest following coding.
>How about?

I think the correct fix is to adjust all the timers in settimeofday().
It now says /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
and does nothing.

Another fix is to never use settimeofday() :-).  You should try to use
it only immediately after booting.

Bruce