diff options
-rw-r--r-- | freebsd/sys/kern/kern_time.c | 21 | ||||
-rw-r--r-- | freebsd/sys/opencrypto/crypto.c | 2 | ||||
-rw-r--r-- | rtemsbsd/powerpc/include/linux/time.h | 4 |
3 files changed, 13 insertions, 14 deletions
diff --git a/freebsd/sys/kern/kern_time.c b/freebsd/sys/kern/kern_time.c index 3ec71673..6e394310 100644 --- a/freebsd/sys/kern/kern_time.c +++ b/freebsd/sys/kern/kern_time.c @@ -552,7 +552,7 @@ kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, atomic_load_acq_int(&rtc_generation); error = kern_clock_gettime(td, clock_id, &now); KASSERT(error == 0, ("kern_clock_gettime: %d", error)); - timespecsub(&ts, &now); + timespecsub(&ts, &now, &ts); } if (ts.tv_sec < 0 || (ts.tv_sec == 0 && ts.tv_nsec == 0)) { error = EWOULDBLOCK; @@ -1532,7 +1532,7 @@ realtimer_gettime(struct itimer *it, struct itimerspec *ovalue) realtimer_clocktime(it->it_clockid, &cts); *ovalue = it->it_time; if (ovalue->it_value.tv_sec != 0 || ovalue->it_value.tv_nsec != 0) { - timespecsub(&ovalue->it_value, &cts); + timespecsub(&ovalue->it_value, &cts, &ovalue->it_value); if (ovalue->it_value.tv_sec < 0 || (ovalue->it_value.tv_sec == 0 && ovalue->it_value.tv_nsec == 0)) { @@ -1573,9 +1573,10 @@ realtimer_settime(struct itimer *it, int flags, ts = val.it_value; if ((flags & TIMER_ABSTIME) == 0) { /* Convert to absolute time. */ - timespecadd(&it->it_time.it_value, &cts); + timespecadd(&it->it_time.it_value, &cts, + &it->it_time.it_value); } else { - timespecsub(&ts, &cts); + timespecsub(&ts, &cts, &ts); /* * We don't care if ts is negative, tztohz will * fix it. @@ -1643,22 +1644,23 @@ realtimer_expire(void *arg) if (timespeccmp(&cts, &it->it_time.it_value, >=)) { if (timespecisset(&it->it_time.it_interval)) { timespecadd(&it->it_time.it_value, - &it->it_time.it_interval); + &it->it_time.it_interval, + &it->it_time.it_value); while (timespeccmp(&cts, &it->it_time.it_value, >=)) { if (it->it_overrun < INT_MAX) it->it_overrun++; else it->it_ksi.ksi_errno = ERANGE; timespecadd(&it->it_time.it_value, - &it->it_time.it_interval); + &it->it_time.it_interval, + &it->it_time.it_value); } } else { /* single shot timer ? */ timespecclear(&it->it_time.it_value); } if (timespecisset(&it->it_time.it_value)) { - ts = it->it_time.it_value; - timespecsub(&ts, &cts); + timespecsub(&it->it_time.it_value, &cts, &ts); TIMESPEC_TO_TIMEVAL(&tv, &ts); callout_reset(&it->it_callout, tvtohz(&tv), realtimer_expire, it); @@ -1669,8 +1671,7 @@ realtimer_expire(void *arg) ITIMER_LOCK(it); itimer_leave(it); } else if (timespecisset(&it->it_time.it_value)) { - ts = it->it_time.it_value; - timespecsub(&ts, &cts); + timespecsub(&it->it_time.it_value, &cts, &ts); TIMESPEC_TO_TIMEVAL(&tv, &ts); callout_reset(&it->it_callout, tvtohz(&tv), realtimer_expire, it); diff --git a/freebsd/sys/opencrypto/crypto.c b/freebsd/sys/opencrypto/crypto.c index 45622c39..c1132ff3 100644 --- a/freebsd/sys/opencrypto/crypto.c +++ b/freebsd/sys/opencrypto/crypto.c @@ -1031,7 +1031,7 @@ crypto_tstat(struct cryptotstat *ts, struct bintime *bt) if (u < delta.frac) delta.sec--; bintime2timespec(&delta, &t); - timespecadd(&ts->acc, &t); + timespecadd(&ts->acc, &t, &ts->acc); if (timespeccmp(&t, &ts->min, <)) ts->min = t; if (timespeccmp(&t, &ts->max, >)) diff --git a/rtemsbsd/powerpc/include/linux/time.h b/rtemsbsd/powerpc/include/linux/time.h index 27516a4c..442d3bfc 100644 --- a/rtemsbsd/powerpc/include/linux/time.h +++ b/rtemsbsd/powerpc/include/linux/time.h @@ -70,9 +70,7 @@ timespec_sub(struct timespec lhs, struct timespec rhs) { struct timespec ts; - ts.tv_sec = lhs.tv_sec; - ts.tv_nsec = lhs.tv_nsec; - timespecsub(&ts, &rhs); + timespecsub(&lhs, &rhs, &ts); return ts; } |