From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57877 invoked by alias); 4 Nov 2019 06:05:21 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 57861 invoked by uid 10080); 4 Nov 2019 06:05:21 -0000 Date: Mon, 04 Nov 2019 06:05:00 -0000 Message-ID: <20191104060521.57860.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Move timeval macros to X-Act-Checkin: newlib-cygwin X-Git-Author: Sebastian Huber X-Git-Refname: refs/heads/master X-Git-Oldrev: aae831b083ab762726bfb2c07584a481e6925b81 X-Git-Newrev: 4082e91b59e7fe34fe50964ecfc970ed2283b3d9 X-SW-Source: 2019-q4/txt/msg00014.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4082e91b59e7fe34fe50964ecfc970ed2283b3d9 commit 4082e91b59e7fe34fe50964ecfc970ed2283b3d9 Author: Sebastian Huber Date: Tue Sep 24 08:34:35 2019 +0200 Move timeval macros to In FreeBSD, NetBSD, and OpenBSD these macros are defined in . Diff: --- newlib/libc/include/sys/_timeval.h | 35 +++-------------------------------- newlib/libc/include/sys/time.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/newlib/libc/include/sys/_timeval.h b/newlib/libc/include/sys/_timeval.h index 676a0b8..6b250c0 100644 --- a/newlib/libc/include/sys/_timeval.h +++ b/newlib/libc/include/sys/_timeval.h @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2002 Mike Barcroft * All rights reserved. * @@ -23,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: head/sys/sys/_timeval.h 326256 2017-11-27 15:01:59Z pfg $ */ #ifndef _SYS__TIMEVAL_H_ @@ -53,37 +55,6 @@ struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* and microseconds */ }; - -#if __BSD_VISIBLE -#ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */ - -#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#define timercmp(tvp, uvp, cmp) \ - (((tvp)->tv_sec == (uvp)->tv_sec) ? \ - ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ - ((tvp)->tv_sec cmp (uvp)->tv_sec)) -#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) -#endif -#endif /* __BSD_VISIBLE */ - #endif /* _TIMEVAL_DEFINED */ #endif /* !_SYS__TIMEVAL_H_ */ diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h index 370c134..84a429b 100644 --- a/newlib/libc/include/sys/time.h +++ b/newlib/libc/include/sys/time.h @@ -367,6 +367,34 @@ tvtosbt(struct timeval _tv) (vsp)->tv_nsec += 1000000000L; \ } \ } while (0) + +#ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */ + +#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec) ? \ + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ + ((tvp)->tv_sec cmp (uvp)->tv_sec)) +#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) +#endif #endif /* __BSD_VISIBLE */ /*