1 /* mktime variant that also uses an offset guess 2 3 Copyright 2016-2018 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public 7 License as published by the Free Software Foundation; either 8 version 3 of the License, or (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 GNU 13 General Public License for more details. 14 15 You should have received a copy of the GNU General Public 16 License along with this program; if not, see 17 <https://www.gnu.org/licenses/>. */ 18 19 #include <time.h> 20 21 /* mktime_offset_t is a signed type wide enough to hold a UTC offset 22 in seconds, and used as part of the type of the offset-guess 23 argument to mktime_internal. Use time_t on platforms where time_t 24 is signed, to be compatible with platforms like BeOS that export 25 this implementation detail of mktime. On platforms where time_t is 26 unsigned, GNU and POSIX code can assume 'int' is at least 32 bits 27 which is wide enough for a UTC offset. */ 28 29 #if TIME_T_IS_SIGNED 30 typedef time_t mktime_offset_t; 31 #else 32 typedef int mktime_offset_t; 33 #endif 34 35 time_t mktime_internal (struct tm *, 36 struct tm * (*) (time_t const *, struct tm *), 37 mktime_offset_t *); 38 39 /* Although glibc source code uses leading underscores, Gnulib wants 40 ordinary names. 41 42 Portable standalone applications should supply a <time.h> that 43 declares a POSIX-compliant localtime_r, for the benefit of older 44 implementations that lack localtime_r or have a nonstandard one. 45 Similarly for gmtime_r. See the gnulib time_r module for one way 46 to implement this. */ 47 48 #undef __gmtime_r 49 #undef __localtime_r 50 #define __gmtime_r gmtime_r 51 #define __localtime_r localtime_r 52 53 #define __mktime_internal mktime_internal 54