- signed long long timespec2ns(struct timespec *ts)
- {
- signed long long ns;
- ns = ts->tv_nsec + (ts->tv_sec * NSEC_PER_SEC);
- return(ns);
- }
- void ns2timespec(signed long long ns, struct timespec *ts)
- {
- lldiv_t lld;
- lld = lldiv(ns, NSEC_PER_SEC);
- ts->tv_sec = lld.quot;
- ts->tv_nsec = lld.rem;
- }
timespec to nanoseconds
Posted by Anonymous on Tue 2nd Nov 2021 10:29
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.