+int adjtimedelta;
+extern int tickadj;
+
+adjtime()
+{
+ register struct a {
+ struct timeval *delta;
+ struct timeval *olddelta;
+ } *uap = (struct a *)u.u_ap;
+ struct timeval atv, oatv;
+ int s;
+
+ if (!suser())
+ return;
+ u.u_error = copyin((caddr_t)uap->delta, (caddr_t)&atv,
+ sizeof (struct timeval));
+ if (u.u_error)
+ return;
+ s = splclock();
+ if (uap->olddelta) {
+ oatv.tv_sec = adjtimedelta / 1000000;
+ oatv.tv_usec = adjtimedelta % 1000000;
+ (void) copyout((caddr_t)&oatv, (caddr_t)uap->olddelta,
+ sizeof (struct timeval));
+ }
+ adjtimedelta = atv.tv_sec * 1000000 + atv.tv_usec;
+ if (adjtimedelta % tickadj)
+ adjtimedelta = adjtimedelta / tickadj * tickadj;
+ splx(s);
+}
+