From 2218a70d376586633451134cb790b5c8d794e431 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 11 Jul 2013 14:30:38 -0400 Subject: Add timersub macro for platforms where it isn't defined --- libs/pbd/pbd/timersub.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libs/pbd/pbd/timersub.h (limited to 'libs/pbd/pbd') diff --git a/libs/pbd/pbd/timersub.h b/libs/pbd/pbd/timersub.h new file mode 100644 index 0000000000..6cb152414c --- /dev/null +++ b/libs/pbd/pbd/timersub.h @@ -0,0 +1,32 @@ +/* Copyright (C) 1991-1994,1996-2003,2005,2006,2009 + Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +#ifndef timersub +# define timersub(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ + } while (0) +#endif + -- cgit v1.2.3