fixing wrong, set 0 val to tick
[unix-history] / usr / src / sys / kern / kern_time.c
index 1065e26..53b5f17 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_time.c     5.13    82/12/28        */
+/*     kern_time.c     5.16    83/06/10        */
 
 #include "../machine/reg.h"
 
 
 #include "../machine/reg.h"
 
@@ -213,7 +213,7 @@ itimerfix(tv)
        if (tv->tv_sec < 0 || tv->tv_sec > 100000000 ||
            tv->tv_usec < 0 || tv->tv_usec >= 1000000)
                return (EINVAL);
        if (tv->tv_sec < 0 || tv->tv_sec > 100000000 ||
            tv->tv_usec < 0 || tv->tv_usec >= 1000000)
                return (EINVAL);
-       if (tv->tv_sec == 0 && tv->tv_usec < tick)
+       if (tv->tv_sec == 0 && tv->tv_usec != 0 && tv->tv_usec < tick)
                tv->tv_usec = tick;
        return (0);
 }
                tv->tv_usec = tick;
        return (0);
 }
@@ -298,72 +298,3 @@ timevalfix(t1)
                t1->tv_usec -= 1000000;
        }
 }
                t1->tv_usec -= 1000000;
        }
 }
-
-#ifndef NOCOMPAT
-otime()
-{
-
-       u.u_r.r_time = time.tv_sec;
-}
-
-ostime()
-{
-       register struct a {
-               int     time;
-       } *uap = (struct a *)u.u_ap;
-       struct timeval tv;
-
-       tv.tv_sec = uap->time;
-       tv.tv_usec = 0;
-       setthetime(&tv);
-}
-
-/* from old timeb.h */
-struct timeb {
-       time_t  time;
-       u_short millitm;
-       short   timezone;
-       short   dstflag;
-};
-
-oftime()
-{
-       register struct a {
-               struct  timeb   *tp;
-       } *uap;
-       struct timeb tb;
-
-       uap = (struct a *)u.u_ap;
-       (void) spl7();
-       tb.time = time.tv_sec;
-       tb.millitm = time.tv_usec / 1000;
-       (void) spl0();
-       tb.timezone = tz.tz_minuteswest;
-       tb.dstflag = tz.tz_dsttime;
-       u.u_error = copyout((caddr_t)&tb, (caddr_t)uap->tp, sizeof (tb));
-}
-
-oalarm()
-{
-       register struct a {
-               int     deltat;
-       } *uap = (struct a *)u.u_ap;
-       register struct proc *p = u.u_procp;
-       int s = spl7();
-
-       untimeout(realitexpire, (caddr_t)p);
-       timerclear(&p->p_realtimer.it_interval);
-       u.u_r.r_val1 = 0;
-       if (timerisset(&p->p_realtimer.it_value) &&
-           timercmp(&p->p_realtimer.it_value, &time, >))
-               u.u_r.r_val1 = p->p_realtimer.it_value.tv_sec - time.tv_sec;
-       if (uap->deltat == 0) {
-               splx(s);
-               return;
-       }
-       p->p_realtimer.it_value = time;
-       p->p_realtimer.it_value.tv_sec += uap->deltat;
-       timeout(realitexpire, (caddr_t)p, hzto(&p->p_realtimer.it_value));
-       splx(s);
-}
-#endif