adding support for mutex from D flag
[csql.git] / include / timecsql.h
blobc49f8eff84b27809eeafcc13287c1f96bad7f70c
1 // COPY of time.h in solaris machine
2 // This copied to avoid compiler error
3 // "Multiple inclusion of std::tm"
4 #ifndef _CSQLTIME_H
5 #define _CSQLTIME_H
7 #pragma ident "@(#)time.h 1.39 99/08/10 SMI" /* SVr4.0 1.18 */
9 #include <sys/feature_tests.h>
10 #include <sys/types.h>
11 #include <iso/time_iso.h>
14 * Allow global visibility for symbols defined in
15 * C++ "std" namespace in <iso/time_iso.h>.
17 #if __cplusplus >= 199711L
18 using std::size_t;
19 using std::clock_t;
20 using std::time_t;
21 //using std::tm;
22 using std::asctime;
23 using std::clock;
24 using std::ctime;
25 using std::difftime;
26 using std::gmtime;
27 using std::localtime;
28 using std::mktime;
29 using std::time;
30 using std::strftime;
31 #endif
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 #ifndef _CLOCKID_T
38 #define _CLOCKID_T
39 typedef int clockid_t;
40 #endif
42 #ifndef _TIMER_T
43 #define _TIMER_T
44 typedef int timer_t;
45 #endif
47 #if defined(__STDC__)
49 #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
50 (_POSIX_C_SOURCE - 0 >= 199506L)
51 extern struct tm *gmtime_r(const time_t *, struct tm *);
52 extern struct tm *localtime_r(const time_t *, struct tm *);
53 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT) .. */
55 #if (__STDC__ == 0 && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
56 (defined(_XOPEN_SOURCE) && _XOPEN_VERSION - 0 >= 4) || \
57 defined(__EXTENSIONS__)
58 extern char *strptime(const char *, const char *, struct tm *);
60 #ifdef _STRPTIME_DONTZERO
61 #ifdef __PRAGMA_REDEFINE_EXTNAME
62 #pragma redefine_extname strptime __strptime_dontzero
63 #else /* __PRAGMA_REDEFINE_EXTNAME */
64 extern char *__strptime_dontzero(const char *, const char *, struct tm *);
65 #define strptime __strptime_dontzero
66 #endif /* __PRAGMA_REDEFINE_EXTNAME */
67 #endif /* _STRPTIME_DONTZERO */
69 #endif /* (__STDC__ == 0 && !defined(_POSIX_C_SOURCE)... */
71 #if defined(__EXTENSIONS__) || ((__STDC__ - 0 == 0) && \
72 !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
73 (_POSIX_C_SOURCE > 2)
74 #include <sys/time_impl.h>
77 * Neither X/Open nor POSIX allow the inclusion of <signal.h> for the
78 * definition of the sigevent structure. Both require the inclusion
79 * of <signal.h> and <time.h> when using the timer_create() function.
80 * However, X/Open also specifies that the sigevent structure be defined
81 * in <time.h> as described in the header <signal.h>. This prevents
82 * compiler warnings for applications that only include <time.h> and not
83 * also <signal.h>. The sigval union and the sigevent structure is
84 * therefore defined both here and in <sys/siginfo.h> which gets included
85 * via inclusion of <signal.h>.
87 #ifndef _SIGVAL
88 #define _SIGVAL
89 union sigval {
90 int sival_int; /* integer value */
91 void *sival_ptr; /* pointer value */
93 #endif /* _SIGVAL */
95 #ifndef _SIGEVENT
96 #define _SIGEVENT
97 struct sigevent {
98 int sigev_notify; /* notification mode */
99 int sigev_signo; /* signal number */
100 union sigval sigev_value; /* signal value */
101 void (*sigev_notify_function)(union sigval);
102 pthread_attr_t *sigev_notify_attributes;
103 int __sigev_pad2;
105 #endif /* _SIGEVENT */
107 extern int clock_getres(clockid_t, struct timespec *);
108 extern int clock_gettime(clockid_t, struct timespec *);
109 extern int clock_settime(clockid_t, const struct timespec *);
110 extern int timer_create(clockid_t, struct sigevent *, timer_t *);
111 extern int timer_delete(timer_t);
112 extern int timer_getoverrun(timer_t);
113 extern int timer_gettime(timer_t, struct itimerspec *);
114 extern int timer_settime(timer_t, int, const struct itimerspec *,
115 struct itimerspec *);
116 extern int nanosleep(const struct timespec *, struct timespec *);
117 #endif /* defined(__EXTENSIONS__) || ((__STDC__ - 0 == 0 && ... */
119 #if defined(__EXTENSIONS__) || __STDC__ == 0 || \
120 defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
121 extern void tzset(void);
123 extern char *tzname[2];
125 #ifndef CLK_TCK
126 extern long _sysconf(int); /* System Private interface to sysconf() */
127 #define CLK_TCK ((clock_t) _sysconf(3)) /* clock ticks per second */
128 /* 3 is _SC_CLK_TCK */
129 #endif
131 #if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
132 !defined(_POSIX_C_SOURCE)) || defined(_XOPEN_SOURCE)
133 extern long timezone;
134 extern int daylight;
135 #endif
137 #endif
139 #if __STDC__ == 0 && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
140 extern int cftime(char *, char *, const time_t *);
141 extern int ascftime(char *, const char *, const struct tm *);
142 extern long altzone;
143 #endif
145 #if (__STDC__ == 0 && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
146 defined(_XPG4_2) || defined(__EXTENSIONS__)
147 extern struct tm *getdate(const char *);
149 #ifdef _REENTRANT
150 #undef getdate_err
151 #define getdate_err *(int *)_getdate_err_addr()
152 extern int *_getdate_err_addr(void);
153 #else
154 extern int getdate_err;
155 #endif /* _REENTRANT */
156 #endif /* __STDC__ == 0 && !defined(_POSIX_C_SOURCE) ... */
158 #else /* __STDC__ */
160 extern char *strptime();
161 extern int cftime(), ascftime();
162 extern void tzset();
164 #ifdef _STRPTIME_DONTZERO
165 #ifdef __PRAGMA_REDEFINE_EXTNAME
166 #pragma redefine_extname strptime __strptime_dontzero
167 #else /* __PRAGMA_REDEFINE_EXTNAME */
168 extern char *__strptime_dontzero();
169 #define strptime __strptime_dontzero
170 #endif /* __PRAGMA_REDEFINE_EXTNAME */
171 #endif /* _STRPTIME_DONTZERO */
174 #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
175 (_POSIX_C_SOURCE - 0 >= 199506L)
176 extern struct tm *gmtime_r();
177 extern struct tm *localtime_r();
178 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT) .. */
180 extern long timezone, altzone;
181 extern int daylight;
182 extern char *tzname[2];
184 #if (__STDC__ == 0 && !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
185 defined(_XPG4_2) || defined(__EXTENSIONS__)
186 extern struct tm *getdate();
187 #ifdef _REENTRANT
188 #undef getdate_err
189 #define getdate_err *(int *)_getdate_err_addr()
190 extern int *_getdate_err_addr();
191 #else
192 extern int getdate_err;
193 #endif /* _REENTRANT */
194 #endif /* __STDC__ == 0 && !defined(_POSIX_C_SOURCE) ... */
197 #endif /* __STDC__ */
200 * ctime_r() & asctime_r() prototypes are defined here.
204 * Previous releases of Solaris, starting at 2.3, provided definitions of
205 * various functions as specified in POSIX.1c, Draft 6. For some of these
206 * functions, the final POSIX 1003.1c standard had a different number of
207 * arguments and return values.
209 * The following segment of this header provides support for the standard
210 * interfaces while supporting applications written under earlier
211 * releases. The application defines appropriate values of the feature
212 * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
213 * whether it was written to expect the Draft 6 or standard versions of
214 * these interfaces, before including this header. This header then
215 * provides a mapping from the source version of the interface to an
216 * appropriate binary interface. Such mappings permit an application
217 * to be built from libraries and objects which have mixed expectations
218 * of the definitions of these functions.
220 * For applications using the Draft 6 definitions, the binary symbol is
221 * the same as the source symbol, and no explicit mapping is needed. For
222 * the standard interface, the function func() is mapped to the binary
223 * symbol _posix_func(). The preferred mechanism for the remapping is a
224 * compiler #pragma. If the compiler does not provide such a #pragma, the
225 * header file defines a static function func() which calls the
226 * _posix_func() version; this is required if the application needs to
227 * take the address of func().
229 * NOTE: Support for the Draft 6 definitions is provided for compatibility
230 * only. New applications/libraries should use the standard definitions.
233 #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
234 (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
236 #if defined(__STDC__)
238 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
240 #ifdef __PRAGMA_REDEFINE_EXTNAME
241 extern char *asctime_r(const struct tm *, char *);
242 extern char *ctime_r(const time_t *, char *);
243 #pragma redefine_extname ctime_r __posix_ctime_r
244 #pragma redefine_extname asctime_r __posix_asctime_r
245 #else /* __PRAGMA_REDEFINE_EXTNAME */
247 static char *
248 asctime_r(const struct tm *__tm, char *__buf)
250 extern char *__posix_asctime_r(const struct tm *, char *);
251 return (__posix_asctime_r(__tm, __buf));
253 static char *
254 ctime_r(const time_t *__time, char *__buf)
256 extern char *__posix_ctime_r(const time_t *, char *);
257 return (__posix_ctime_r(__time, __buf));
259 #endif /* __PRAGMA_REDEFINE_EXTNAME */
261 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
263 extern char *asctime_r(const struct tm *, char *, int);
264 extern char *ctime_r(const time_t *, char *, int);
266 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
268 #else /* __STDC__ */
270 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
272 #ifdef __PRAGMA_REDEFINE_EXTNAME
273 extern char *asctime_r();
274 extern char *ctime_r();
275 #pragma redefine_extname asctime_r __posix_asctime_r
276 #pragma redefine_extname ctime_r __posix_ctime_r
277 #else /* __PRAGMA_REDEFINE_EXTNAME */
279 static char *
280 asctime_r(__tm, __buf)
281 struct tm *__tm;
282 char *__buf;
284 extern char *__posix_asctime_r();
285 return (__posix_asctime_r(__tm, __buf));
287 static char *
288 ctime_r(__time, __buf)
289 time_t *__time;
290 char *__buf;
292 extern char *__posix_ctime_r();
293 return (__posix_ctime_r(__time, __buf));
295 #endif /* __PRAGMA_REDEFINE_EXTNAME */
297 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
299 extern char *asctime_r();
300 extern char *ctime_r();
302 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
304 #endif /* __STDC__ */
306 #endif /* defined(__EXTENSIONS__) || (__STDC__ == 0 ... */
308 #ifdef __cplusplus
310 #endif
312 #endif /* _TIME_H */