Date: Sun, 22 Aug 1999 19:59:19 -0400 (EDT) From: Kelly Yancey <kbyanc@kronos.alcnet.com> To: FreeBSD-gnats-submit@freebsd.org Subject: misc/13326: additional timeval interfaces for <sys/time.h> Message-ID: <199908222359.TAA26773@kronos.alcnet.com>
next in thread | raw e-mail | index | archive | help
>Number: 13326 >Category: misc >Synopsis: additional timeval interfaces for <sys/time.h> >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Aug 22 17:00:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Kelly Yancey >Release: FreeBSD 3.2-STABLE i386 >Organization: >Environment: >Description: 2 new interfaces for manipulating timeval structures in addition to those provided for NetBSD/OpenBSD compatibility in <sys/time.h> Admittingly, they aren't strickly necissary, but seeing as how they increase readability of code which manipulates timevals, don't add any bloat unless they are used (in which care they aren't bloat), and extend functionality already provided by <sys/time.h>, I think that they would make good additions to FreeBSD. --- /usr/include/sys/time.h.orig Sun Aug 22 18:33:57 1999 +++ /usr/include/sys/time.h Sun Aug 22 18:45:12 1999 @@ -224,6 +224,23 @@ } while (0) #endif +#ifndef KERNEL /* additional timeval manipulations */ +#define timermul(tvp, uvp, x) \ + do { \ + (uvp)->tv_sec = (tvp)->tv_sec * x; \ + (uvp)->tv_usec = (tvp)->tv_usec * x; \ + while((uvp)->tv_usec > 1000000) { \ + (uvp)->tv_sec++; \ + (uvp)->tv_usec -= 1000000; \ + } \ + } while(0) +#define timerdiv(tvp, uvp, x) \ + do { \ + (uvp)->tv_sec = (tvp)->tv_sec / x; \ + (uvp)->tv_usec = (tvp)->tv_usec / x; \ + } while(0) +#endif + /* * Names of the interval timers, and structure * defining a timer setting. >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908222359.TAA26773>