Create timeval2timespec() and timespec2timeval().
These functions will be used by process descriptors to convert process creation time into process descriptor [acm]time. Approved by: re (kib), mentor (rwatson) Suggested by: jhb Sponsored by: Google Inc
This commit is contained in:
parent
ef068c6d9f
commit
ef5502c5dd
@ -195,6 +195,24 @@ timeval2bintime(const struct timeval *tv, struct bintime *bt)
|
|||||||
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
|
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
|
||||||
((tvp)->tv_sec cmp (uvp)->tv_sec))
|
((tvp)->tv_sec cmp (uvp)->tv_sec))
|
||||||
|
|
||||||
|
/* Conversion between timespec and timeval. */
|
||||||
|
|
||||||
|
static __inline void
|
||||||
|
timeval2timespec(const struct timeval *tv, struct timespec *ts)
|
||||||
|
{
|
||||||
|
|
||||||
|
ts->tv_sec = tv->tv_sec;
|
||||||
|
ts->tv_nsec = 1000 * tv->tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline void
|
||||||
|
timespec2timeval(const struct timespec *ts, struct timeval *tv)
|
||||||
|
{
|
||||||
|
|
||||||
|
tv->tv_sec = ts->tv_sec;
|
||||||
|
tv->tv_usec = ts->tv_nsec / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
/* timevaladd and timevalsub are not inlined */
|
/* timevaladd and timevalsub are not inlined */
|
||||||
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user