~drizzle-trunk/drizzle/development

815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
1
/* A more-standard <time.h>.
2
994.2.8 by Monty Taylor
Updated gnulib files.
3
   Copyright (C) 2007-2008 Free Software Foundation, Inc.
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
4
5
   This program is free software; you can redistribute it and/or modify
6
   it under the terms of the GNU Lesser General Public License as published by
7
   the Free Software Foundation; either version 2, or (at your option)
8
   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 Lesser General Public License for more details.
14
15
   You should have received a copy of the GNU Lesser General Public License
16
   along with this program; if not, write to the Free Software Foundation,
17
   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
994.2.8 by Monty Taylor
Updated gnulib files.
19
#if __GNUC__ >= 3
20
@PRAGMA_SYSTEM_HEADER@
971.4.1 by Monty Taylor
GCC on Solaris build fixes.
21
#endif
22
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
23
/* Don't get in the way of glibc when it includes time.h merely to
24
   declare a few standard symbols, rather than to declare all the
25
   symbols.  Also, Solaris 8 <time.h> eventually includes itself
26
   recursively; if that is happening, just include the system <time.h>
27
   without adding our own declarations.  */
28
#if (defined __need_time_t || defined __need_clock_t \
29
     || defined __need_timespec \
30
     || defined _GL_TIME_H)
31
32
# @INCLUDE_NEXT@ @NEXT_TIME_H@
33
34
#else
35
36
# define _GL_TIME_H
37
38
# @INCLUDE_NEXT@ @NEXT_TIME_H@
39
40
# ifdef __cplusplus
41
extern "C" {
42
# endif
43
44
/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
45
   Or they define it with the wrong member names or define it in <sys/time.h>
46
   (e.g., FreeBSD circa 1997).  */
47
# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
48
#  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
49
#   include <sys/time.h>
50
#  else
51
#   undef timespec
52
#   define timespec rpl_timespec
53
struct timespec
54
{
55
  time_t tv_sec;
56
  long int tv_nsec;
57
};
58
#  endif
59
# endif
60
61
/* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
62
   return -1 and store the remaining time into RMTP.  See
63
   <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
64
# if @REPLACE_NANOSLEEP@
65
#  define nanosleep rpl_nanosleep
66
int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
67
# endif
68
1093.8.1 by rm
fix for gnulib mktime test & replacement (adaptation of patch from Bruno Haible)
69
/* Return the 'time_t' representation of TP and normalize TP.  */
70
# if @REPLACE_MKTIME@
71
#  define mktime rpl_mktime
72
extern time_t mktime (struct tm *__tp);
73
# endif
74
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
75
/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
76
   <http://www.opengroup.org/susv3xsh/localtime_r.html> and
77
   <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
78
# if @REPLACE_LOCALTIME_R@
79
#  undef localtime_r
80
#  define localtime_r rpl_localtime_r
81
#  undef gmtime_r
82
#  define gmtime_r rpl_gmtime_r
83
struct tm *localtime_r (time_t const *restrict __timer,
84
			struct tm *restrict __result);
85
struct tm *gmtime_r (time_t const *restrict __timer,
86
		     struct tm *restrict __result);
87
# endif
88
89
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
90
   the resulting broken-down time into TM.  See
91
   <http://www.opengroup.org/susv3xsh/strptime.html>.  */
92
# if @REPLACE_STRPTIME@
93
#  undef strptime
94
#  define strptime rpl_strptime
95
char *strptime (char const *restrict __buf, char const *restrict __format,
96
		struct tm *restrict __tm);
97
# endif
98
99
/* Convert TM to a time_t value, assuming UTC.  */
994.2.8 by Monty Taylor
Updated gnulib files.
100
# if @REPLACE_TIMEGM@
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
101
#  undef timegm
102
#  define timegm rpl_timegm
103
time_t timegm (struct tm *__tm);
104
# endif
105
106
/* Encourage applications to avoid unsafe functions that can overrun
107
   buffers when given outlandish struct tm values.  Portable
108
   applications should use strftime (or even sprintf) instead.  */
994.2.8 by Monty Taylor
Updated gnulib files.
109
# if GNULIB_PORTCHECK
815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
110
#  undef asctime
111
#  define asctime eschew_asctime
112
#  undef asctime_r
113
#  define asctime_r eschew_asctime_r
114
#  undef ctime
115
#  define ctime eschew_ctime
116
#  undef ctime_r
117
#  define ctime_r eschew_ctime_r
118
# endif
119
120
# ifdef __cplusplus
121
}
122
# endif
123
124
#endif