Lines Matching defs:ts
68 struct timespec now, ts;
70 ts = *tsp; /* Don't modify original tsp. */
72 timespecsub(&ts, &now, &ts);
73 return tstohz(&ts);
79 struct timespec now, ts;
81 ts = *tsp; /* Don't modify original tsp. */
83 timespecsub(&ts, &now, &ts);
84 return tstohz(&ts);
91 tstohz(const struct timespec *ts)
99 TIMESPEC_TO_TIMEVAL(&tv, ts);
104 inittimeleft(struct timespec *ts, struct timespec *sleepts)
107 if (itimespecfix(ts)) {
110 KASSERT(ts->tv_sec >= 0);
116 gettimeleft(struct timespec *ts, struct timespec *sleepts)
120 KASSERT(ts->tv_sec >= 0);
123 * Reduce ts by elapsed time based on monotonic time scale.
130 if (timespeccmp(ts, &sleptts, <=)) { /* timed out */
131 timespecclear(ts);
134 timespecsub(ts, &sleptts, ts);
136 return tstohz(ts);
140 clock_timeleft(clockid_t clockid, struct timespec *ts, struct timespec *sleepts)
145 timespecadd(ts, sleepts, ts);
146 timespecsub(ts, &sleptts, ts);
151 clock_gettime1(clockid_t clock_id, struct timespec *ts)
180 TIMEVAL_TO_TIMESPEC(&cputime, ts);
197 bintime2timespec(&tm, ts);
203 nanotime(ts);
206 nanouptime(ts);
219 ts2timo(clockid_t clock_id, int flags, struct timespec *ts,
225 if (ts->tv_nsec < 0 || ts->tv_nsec >= 1000000000L)
237 if (!timespecsubok(ts, &tsd))
239 timespecsub(ts, &tsd, &tsd);
240 ts = &tsd;
243 error = itimespecfix(ts);
247 if (ts->tv_sec == 0 && ts->tv_nsec == 0)
250 *timo = tstohz(ts);