From owner-freebsd-bugs Thu Sep 2 14:30: 7 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 8F65714C99 for ; Thu, 2 Sep 1999 14:30:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id OAA75291; Thu, 2 Sep 1999 14:30:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Thu, 2 Sep 1999 14:30:03 -0700 (PDT) Message-Id: <199909022130.OAA75291@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Kelly Yancey" Subject: Re: misc/13326: additional timeval interfaces for Reply-To: "Kelly Yancey" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR misc/13326; it has been noted by GNATS. From: "Kelly Yancey" To: , Cc: Subject: Re: misc/13326: additional timeval interfaces for Date: Thu, 2 Sep 1999 17:26:46 -0400 Updates to previous patch per suggestions by Poul-Henning Kamp... Kelly ~kbyanc@posi.net~ FreeBSD - The Power To Serve - http://www.freebsd.org/ Join Team FreeBSD - http://www.posi.net/freebsd/Team-FreeBSD/ "The ultimate result of shielding men from the effects of folly is to fill the world with fools." - Herbert Spencer --- /usr/include/sys/time.h.orig Thu Sep 2 14:35:53 1999 +++ /usr/include/sys/time.h Thu Sep 2 16:41:25 1999 @@ -155,8 +155,6 @@ struct timecounter *tc_tweak; }; -#ifdef KERNEL - /* Operations on timespecs */ #define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0) #define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec) @@ -182,6 +180,32 @@ (vvp)->tv_nsec += 1000000000; \ } \ } while (0) +#define timespecmul(tvp, uvp, x) \ + do { \ + (uvp)->tv_sec = ((tvp)->tv_sec * x) + \ + (quad_t)(tvp)->tv_nsec * x / 1000000000;\ + (uvp)->tv_nsec = (quad_t)(tvp)->tv_nsec * x % 1000000000;\ + } while(0) +#define timespecdiv(tvp, uvp, x) \ + do { \ + (uvp)->tv_sec = (tvp)->tv_sec / x; \ + (uvp)->tv_nsec = (tvp)->tv_nsec / x; \ + } while(0) + +/* + * Operations for converting timespecs to/from quad_t's representing + * times in nanoseconds. + */ +#define tstoq(tvp, q) \ + do { \ + q = ((tvp)->tv_sec * 1000000000) + (tvp)->tv_nsec; \ + } while(0) +#define qtots(q, tvp) \ + do { \ + (tvp)->tv_sec = q / 1000000000; \ + (tvp)->tv_nsec = q % 1000000000; \ + } while(0) +#ifdef KERNEL /* Operations on timevals. */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message