From owner-freebsd-hackers Tue Oct 15 19:48:19 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id TAA00728 for hackers-outgoing; Tue, 15 Oct 1996 19:48:19 -0700 (PDT) Received: from friley216.res.iastate.edu (friley216.res.iastate.edu [129.186.78.216]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id TAA00714 for ; Tue, 15 Oct 1996 19:48:06 -0700 (PDT) Received: from friley216.res.iastate.edu (loopback [127.0.0.1]) by friley216.res.iastate.edu (8.7.6/8.7.3) with ESMTP id VAA00535 for ; Tue, 15 Oct 1996 21:47:55 -0500 (CDT) Message-Id: <199610160247.VAA00535@friley216.res.iastate.edu> To: hackers@FreeBSD.org Subject: Proposed addition to sys/time.h.. Date: Tue, 15 Oct 1996 21:47:55 -0500 From: "Chris Csanady" Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk I was wondering if someone would like to add in the following macros from NetBSD's sys/time.h. They are really quite handy. Anyway, I really hate sending this here, but what should I do with small code change requests/etc? Laters, Chris Csanady #define timeradd(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ if ((vvp)->tv_usec >= 1000000) { \ (vvp)->tv_sec++; \ (vvp)->tv_usec -= 1000000; \ } \ } while (0) #define timersub(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ if ((vvp)->tv_usec < 0) { \ (vvp)->tv_sec--; \ (vvp)->tv_usec += 1000000; \ } \ } while (0)