struct bintime
Jeremie Le Hen
jlh at FreeBSD.org
Thu Oct 16 22:15:58 UTC 2014
Hi,
I need to get microseconds from a struct bintime. I found
bintime2timeval() in sys/time.h which more or less does this, but I
don't understand how the computation works.
Can someone explain it to me please?
static __inline void
bintime2timeval(const struct bintime *_bt, struct timeval *_tv)
{
_tv->tv_sec = _bt->sec;
_tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(_bt->frac >> 32)) >> 32;
}
Thanks!
--
Jeremie Le Hen
jlh at FreeBSD.org
More information about the freebsd-hackers
mailing list