1/* Copyright (C) 2015-2023 Free Software Foundation, Inc.
2
3   This file is part of GDB.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18#ifndef COMMON_GDB_SYS_TIME_H
19#define COMMON_GDB_SYS_TIME_H
20
21#include <sys/time.h>
22
23/* On MinGW-w64, gnulib's sys/time.h replaces 'struct timeval' and
24   gettimeofday with versions that support 64-bit time_t, for POSIX
25   compliance.  However, the gettimeofday replacement does not ever
26   return time_t values larger than 31-bit, as it simply returns the
27   system's gettimeofday's (signed) 32-bit result as (signed) 64-bit.
28   Because we don't really need the POSIX compliance, and it ends up
29   causing conflicts with other libraries we use that don't use gnulib
30   and thus work with the native struct timeval, such as Winsock2's
31   native 'select' and libiberty, simply undefine away gnulib's
32   replacements.  */
33#if GNULIB_defined_struct_timeval
34# undef timeval
35# undef gettimeofday
36#endif
37
38#endif /* COMMON_GDB_SYS_TIME_H */
39