xref: /netbsd-src/external/gpl2/xcvs/dist/lib/time_r.h (revision a7c918477dd5f12c1da816ba05caf44eab2d06d6)
1*a7c91847Schristos /* Reentrant time functions like localtime_r.
2*a7c91847Schristos 
3*a7c91847Schristos    Copyright (C) 2003, 2005 Free Software Foundation, Inc.
4*a7c91847Schristos 
5*a7c91847Schristos    This program is free software; you can redistribute it and/or modify
6*a7c91847Schristos    it under the terms of the GNU General Public License as published by
7*a7c91847Schristos    the Free Software Foundation; either version 2, or (at your option)
8*a7c91847Schristos    any later version.
9*a7c91847Schristos 
10*a7c91847Schristos    This program is distributed in the hope that it will be useful,
11*a7c91847Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*a7c91847Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*a7c91847Schristos    GNU General Public License for more details.
14*a7c91847Schristos 
15*a7c91847Schristos    You should have received a copy of the GNU General Public License along
16*a7c91847Schristos    with this program; if not, write to the Free Software Foundation,
17*a7c91847Schristos    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18*a7c91847Schristos 
19*a7c91847Schristos /* Written by Paul Eggert.  */
20*a7c91847Schristos 
21*a7c91847Schristos #ifndef _TIME_R_H
22*a7c91847Schristos #define _TIME_R_H
23*a7c91847Schristos 
24*a7c91847Schristos /* Include <time.h> first, since it may declare these functions with
25*a7c91847Schristos    signatures that disagree with POSIX, and we don't want to rename
26*a7c91847Schristos    those declarations.  */
27*a7c91847Schristos #include <time.h>
28*a7c91847Schristos 
29*a7c91847Schristos #if !HAVE_TIME_R_POSIX
30*a7c91847Schristos # undef asctime_r
31*a7c91847Schristos # undef ctime_r
32*a7c91847Schristos # undef gmtime_r
33*a7c91847Schristos # undef localtime_r
34*a7c91847Schristos 
35*a7c91847Schristos # define asctime_r rpl_asctime_r
36*a7c91847Schristos # define ctime_r rpl_ctime_r
37*a7c91847Schristos # define gmtime_r rpl_gmtime_r
38*a7c91847Schristos # define localtime_r rpl_localtime_r
39*a7c91847Schristos 
40*a7c91847Schristos /* See the POSIX:2001 specification
41*a7c91847Schristos    <http://www.opengroup.org/susv3xsh/asctime.html>.  */
42*a7c91847Schristos char *asctime_r (struct tm const * restrict, char * restrict);
43*a7c91847Schristos 
44*a7c91847Schristos /* See the POSIX:2001 specification
45*a7c91847Schristos    <http://www.opengroup.org/susv3xsh/ctime.html>.  */
46*a7c91847Schristos char *ctime_r (time_t const *, char *);
47*a7c91847Schristos 
48*a7c91847Schristos /* See the POSIX:2001 specification
49*a7c91847Schristos    <http://www.opengroup.org/susv3xsh/gmtime.html>.  */
50*a7c91847Schristos struct tm *gmtime_r (time_t const * restrict, struct tm * restrict);
51*a7c91847Schristos 
52*a7c91847Schristos /* See the POSIX:2001 specification
53*a7c91847Schristos    <http://www.opengroup.org/susv3xsh/localtime.html>.  */
54*a7c91847Schristos struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
55*a7c91847Schristos #endif
56*a7c91847Schristos 
57*a7c91847Schristos #endif
58