From owner-freebsd-bugs Sun Aug 22 17: 2:39 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 F1FBA14EFE for ; Sun, 22 Aug 1999 17:02:37 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id RAA99170; Sun, 22 Aug 1999 17:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from kronos.alcnet.com (kronos.alcnet.com [63.69.28.22]) by hub.freebsd.org (Postfix) with ESMTP id BAF3D14BED for ; Sun, 22 Aug 1999 16:59:29 -0700 (PDT) (envelope-from kbyanc@kronos.alcnet.com) Received: (from kbyanc@localhost) by kronos.alcnet.com (8.9.3/8.9.3/antispam) id TAA26773; Sun, 22 Aug 1999 19:59:19 -0400 (EDT) Message-Id: <199908222359.TAA26773@kronos.alcnet.com> Date: Sun, 22 Aug 1999 19:59:19 -0400 (EDT) From: Kelly Yancey Reply-To: kbyanc@kronos.alcnet.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: misc/13326: additional timeval interfaces for Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 13326 >Category: misc >Synopsis: additional timeval interfaces for >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 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 , 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