~drizzle-trunk/drizzle/development

815.1.1 by Monty Taylor
Add timegm which is missing on Solaris.
1
/* A more-standard <time.h>.
2
3
   Copyright (C) 2007 Free Software Foundation, Inc.
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
19
/* Don't get in the way of glibc when it includes time.h merely to
20
   declare a few standard symbols, rather than to declare all the
21
   symbols.  Also, Solaris 8 <time.h> eventually includes itself
22
   recursively; if that is happening, just include the system <time.h>
23
   without adding our own declarations.  */
24
#if (defined __need_time_t || defined __need_clock_t \
25
     || defined __need_timespec \
26
     || defined _GL_TIME_H)
27
28
# @INCLUDE_NEXT@ @NEXT_TIME_H@
29
30
#else
31
32
# define _GL_TIME_H
33
34
# @INCLUDE_NEXT@ @NEXT_TIME_H@
35
36
# ifdef __cplusplus
37
extern "C" {
38
# endif
39
40
/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
41
   Or they define it with the wrong member names or define it in <sys/time.h>
42
   (e.g., FreeBSD circa 1997).  */
43
# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
44
#  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
45
#   include <sys/time.h>
46
#  else
47
#   undef timespec
48
#   define timespec rpl_timespec
49
struct timespec
50
{
51
  time_t tv_sec;
52
  long int tv_nsec;
53
};
54
#  endif
55
# endif
56
57
/* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
58
   return -1 and store the remaining time into RMTP.  See
59
   <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
60
# if @REPLACE_NANOSLEEP@
61
#  define nanosleep rpl_nanosleep
62
int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
63
# endif
64
65
/* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
66
   <http://www.opengroup.org/susv3xsh/localtime_r.html> and
67
   <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
68
# if @REPLACE_LOCALTIME_R@
69
#  undef localtime_r
70
#  define localtime_r rpl_localtime_r
71
#  undef gmtime_r
72
#  define gmtime_r rpl_gmtime_r
73
struct tm *localtime_r (time_t const *restrict __timer,
74
			struct tm *restrict __result);
75
struct tm *gmtime_r (time_t const *restrict __timer,
76
		     struct tm *restrict __result);
77
# endif
78
79
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
80
   the resulting broken-down time into TM.  See
81
   <http://www.opengroup.org/susv3xsh/strptime.html>.  */
82
# if @REPLACE_STRPTIME@
83
#  undef strptime
84
#  define strptime rpl_strptime
85
char *strptime (char const *restrict __buf, char const *restrict __format,
86
		struct tm *restrict __tm);
87
# endif
88
89
/* Convert TM to a time_t value, assuming UTC.  */
90
# if @REPLACE_TIMEGM@
91
#  undef timegm
92
#  define timegm rpl_timegm
93
time_t timegm (struct tm *__tm);
94
# endif
95
96
/* Encourage applications to avoid unsafe functions that can overrun
97
   buffers when given outlandish struct tm values.  Portable
98
   applications should use strftime (or even sprintf) instead.  */
99
# if GNULIB_PORTCHECK
100
#  undef asctime
101
#  define asctime eschew_asctime
102
#  undef asctime_r
103
#  define asctime_r eschew_asctime_r
104
#  undef ctime
105
#  define ctime eschew_ctime
106
#  undef ctime_r
107
#  define ctime_r eschew_ctime_r
108
# endif
109
110
# ifdef __cplusplus
111
}
112
# endif
113
114
#endif