xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/gdb_sys_time.h (revision 5ba1f45f2a09259cc846f20c7c5501604d633c90)
1*5ba1f45fSchristos /* Copyright (C) 2015-2024 Free Software Foundation, Inc.
28dffb485Schristos 
38dffb485Schristos    This file is part of GDB.
48dffb485Schristos 
58dffb485Schristos    This program is free software; you can redistribute it and/or modify
68dffb485Schristos    it under the terms of the GNU General Public License as published by
78dffb485Schristos    the Free Software Foundation; either version 3 of the License, or
88dffb485Schristos    (at your option) any later version.
98dffb485Schristos 
108dffb485Schristos    This program is distributed in the hope that it will be useful,
118dffb485Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
128dffb485Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
138dffb485Schristos    GNU General Public License for more details.
148dffb485Schristos 
158dffb485Schristos    You should have received a copy of the GNU General Public License
168dffb485Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
178dffb485Schristos 
188dffb485Schristos #ifndef COMMON_GDB_SYS_TIME_H
198dffb485Schristos #define COMMON_GDB_SYS_TIME_H
208dffb485Schristos 
218dffb485Schristos #include <sys/time.h>
228dffb485Schristos 
238dffb485Schristos /* On MinGW-w64, gnulib's sys/time.h replaces 'struct timeval' and
248dffb485Schristos    gettimeofday with versions that support 64-bit time_t, for POSIX
258dffb485Schristos    compliance.  However, the gettimeofday replacement does not ever
268dffb485Schristos    return time_t values larger than 31-bit, as it simply returns the
278dffb485Schristos    system's gettimeofday's (signed) 32-bit result as (signed) 64-bit.
288dffb485Schristos    Because we don't really need the POSIX compliance, and it ends up
298dffb485Schristos    causing conflicts with other libraries we use that don't use gnulib
308dffb485Schristos    and thus work with the native struct timeval, such as Winsock2's
318dffb485Schristos    native 'select' and libiberty, simply undefine away gnulib's
328dffb485Schristos    replacements.  */
338dffb485Schristos #if GNULIB_defined_struct_timeval
348dffb485Schristos # undef timeval
358dffb485Schristos # undef gettimeofday
368dffb485Schristos #endif
378dffb485Schristos 
388dffb485Schristos #endif /* COMMON_GDB_SYS_TIME_H */
39