Ticket #9379: user_time.h

File user_time.h, 16.4 KB (added by gengyonghui@…, 9 years ago)
Line 
1/* HPUX_ID: @(#)B11.23_LR $Revision: ../hdr/time.h@@/main/i80/11 $ */
2#ifndef _TIME_INCLUDED
3#define _TIME_INCLUDED
4#include <sys/stdsyms.h>
5
6#ifndef _FAST_SHLIB_CALLS
7# if defined(_HP_SHLIB_CALLS) && !defined(__LP64__)
8# define _FAST_SHLIB_CALLS
9# endif
10#endif /* _FAST_SHLIB_CALLS */
11
12/*
13 * For CASPEC, include tm_* macros and identifiers here
14 * But for all other cases, maintain definitions in sys/time.h
15 */
16
17#ifdef _INCLUDE_HPUX_SOURCE
18#ifdef __INCLUDE_FROM_TIME_H
19#undef __INCLUDE_FROM_TIME_H
20#endif /* __INCLUDE_FROM_TIME_H */
21#define __INCLUDE_FROM_TIME_H
22#include <sys/time.h>
23# ifndef _GET_EXPIRATION_TIME
24# define _GET_EXPIRATION_TIME
25# if defined(__ia64)
26 /* pragmas needed to support -B protected */
27# pragma extern get_expiration_time
28# endif /* __ia64 */
29# ifdef _HP_SHLIB_CALLS
30# pragma HP_DEFINED_EXTERNAL get_expiration_time
31# endif /* _HP_SHLIB_CALLS */
32# ifdef _FAST_SHLIB_CALLS
33# pragma HP_NO_RELOCATION get_expiration_time
34# pragma HP_LONG_RETURN get_expiration_time
35# endif /* _FAST_SHLIB_CALLS */
36 extern int get_expiration_time __((struct timespec *,struct timespec *));
37# endif /* _GET_EXPIRATION_TIME */
38# undef __INCLUDE_FROM_TIME_H
39#if !defined(__STDC_32_MODE__)
40typedef int64_t hrtime_t; /* not defined for true ANSI-C name space */
41#endif
42
43# ifdef __cplusplus
44 extern "C" {
45# endif /* __cplusplus */
46#if !defined(__STDC_32_MODE__)
47# ifdef _PROTOTYPES
48extern hrtime_t gethrtime(void);
49#else
50extern hrtime_t gethrtime();
51#endif /* _PROTOTYPES */
52#endif
53# ifdef __cplusplus
54 }
55# endif /* __cplusplus */
56# if defined(__ia64)
57 /* pragmas needed to support -B protected */
58
59#if !defined(__STDC_32_MODE__)
60# ifndef _GETHRTIME
61# pragma extern gethrtime
62# endif /** _GETHRTIME **/
63# endif /* ia64*/
64#endif
65#else /* _INCLUDE_HPUX_SOURCE */
66
67/* ANSI C time constants, types, and structures */
68# ifdef _INCLUDE__STDC__
69
70# ifndef CLOCKS_PER_SEC
71# define CLOCKS_PER_SEC 1000000
72# endif
73
74# ifndef __NULL_INCLUDED
75# include <sys/_null.h>
76# endif /* _NULL_INCLUDED */
77
78 /***
79 ** clock_t and time_t only need to be 32-bits, and are restricted
80 ** to being 32-bits in sys/types.h, however time.h has
81 ** namespace restrictions that do not allow sys/_inttypes.h
82 ** to be included here. Therefore we can not use uint32_t,
83 ** but will have to rely on the knowledge that we are LP64.
84 **/
85# ifndef _CLOCK_T
86# define _CLOCK_T
87# ifdef __ILP64__
88 Error: ILP64 not supported for clock_t in time.h
89# else /** __ILP64__ **/
90_NAMESPACE_STD_START
91 typedef unsigned int clock_t;
92_NAMESPACE_STD_END
93# endif /* __ILP64__ */
94# endif /* _CLOCK_T */
95
96# ifndef _TIME_T_INCLUDED
97# include <sys/_time_t.h>
98# endif /* _TIME_T_INCLUDED */
99
100# ifndef _SIZE_T_INCLUDED
101# include <sys/_size_t.h>
102# endif /* _SIZE_T_INCLUDED */
103
104 /* Structure used with gmtime(), localtime(), mktime(), strftime(). */
105# ifndef _STRUCT_TM
106# define _STRUCT_TM
107_NAMESPACE_STD_START
108 struct tm {
109 int tm_sec; /* second (0-61, allows for leap seconds) */
110 int tm_min; /* minute (0-59) */
111 int tm_hour; /* hour (0-23) */
112 int tm_mday; /* day of the month (1-31) */
113 int tm_mon; /* month (0-11) */
114 int tm_year; /* years since 1900 */
115 int tm_wday; /* day of the week (0-6) */
116 int tm_yday; /* day of the year (0-365) */
117 int tm_isdst; /* non-0 if daylight savings time is in effect */
118 };
119_NAMESPACE_STD_END
120# endif /* _STRUCT_TM */
121# endif /* _INCLUDE__STDC__ */
122
123/*
124 * CLK_TCK is needed by the kernel, and also in the POSIX namespace.
125 */
126
127# ifdef _INCLUDE_POSIX_SOURCE
128# ifndef CLK_TCK
129# define CLK_TCK 100
130# endif /* CLK_TCK */
131# endif
132
133
134 /* Function prototypes and external variable declarations */
135 /* from time.h */
136# ifndef _KERNEL
137# ifdef __cplusplus
138 extern "C" {
139# endif /* __cplusplus */
140
141# ifdef _INCLUDE__STDC__
142
143# if defined(__ia64)
144 /* pragmas needed to support -B protected */
145# ifndef _DIFFTIME
146# pragma extern difftime
147# endif /** _DIFFTIME **/
148# ifndef _MKTIME
149# pragma extern mktime
150# endif /** _MKTIME **/
151# ifndef _TIME
152# pragma extern time
153# endif /** _TIME **/
154# ifndef _ASCTIME
155# pragma extern asctime
156# endif /** _ASCTIME **/
157# ifndef _CTIME
158# pragma extern ctime
159# endif /** _CTIME **/
160# ifndef _GMTIME
161# pragma extern gmtime
162# endif /** _GMTIME **/
163# ifndef _LOCALTIME
164# pragma extern localtime
165# endif /** _LOCALTIME **/
166# ifndef _STRFTIME
167# pragma extern strftime
168# endif /** _STRFTIME **/
169# ifdef _REENTRANT
170# ifndef _ASCTIME_R
171# pragma extern asctime_r
172# endif /* _ASCTIME_R */
173# ifndef _GMTIME_R
174# pragma extern gmtime_r
175# endif /* _GMTIME_R */
176# ifndef _LOCALTIME_R
177# pragma extern localtime_r
178# endif /* _LOCALTIME_R */
179# endif /* _REENTRANT */
180# endif /* __ia64 */
181
182# ifdef _PROTOTYPES
183_NAMESPACE_STD_START
184# ifndef _DIFFTIME
185# define _DIFFTIME
186 extern double difftime(time_t, time_t);
187# endif /** _DIFFTIME **/
188# ifdef _HP_SHLIB_CALLS
189# pragma HP_DEFINED_EXTERNAL mktime
190# endif /* _HP_SHLIB_CALLS */
191# ifdef _FAST_SHLIB_CALLS
192# pragma HP_NO_RELOCATION mktime
193# pragma HP_LONG_RETURN mktime
194# endif /* _FAST_SHLIB_CALLS */
195
196# ifndef _MKTIME
197# define _MKTIME
198 extern time_t mktime(struct tm *);
199# endif /** _MKTIME **/
200# ifndef _TIME
201# define _TIME
202# ifdef _HP_SHLIB_CALLS
203# pragma HP_DEFINED_EXTERNAL time
204# endif /* _HP_SHLIB_CALLS */
205# ifdef _FAST_SHILB_CALLS
206# pragma HP_NO_RELOCATION time
207# pragma HP_LONG_RETURN time
208# endif /* _FAST_SHLIB_CALLS */
209 extern time_t time(time_t *);
210# endif /* _TIME */
211# ifndef _ASCTIME
212# define _ASCTIME
213 extern char *asctime(const struct tm *);
214# endif /* _ASCTIME */
215# ifndef _CTIME
216# define _CTIME
217 extern char *ctime(const time_t *);
218# endif
219# ifndef _GMTIME
220# define _GMTIME
221 extern struct tm *gmtime(const time_t *);
222# endif
223# ifndef _LOCALTIME
224# define _LOCALTIME
225 extern struct tm *localtime(const time_t *);
226# endif
227# ifndef _STRFTIME
228# define _STRFTIME
229# ifdef _HP_SHLIB_CALLS
230# pragma HP_DEFINED_EXTERNAL strftime
231# endif /* _HP_SHLIB_CALLS */
232# ifdef _FAST_SHLIB_CALLS
233# pragma HP_NO_RELOCATION strftime
234# pragma HP_LONG_RETURN strftime
235# endif /* _FAST_SHLIB_CALLS */
236 extern size_t strftime(char *, size_t, const char *, const struct tm *);
237# endif
238_NAMESPACE_STD_END /* namespace std } */
239
240# ifdef _REENTRANT
241# ifndef _ASCTIME_R
242# define _ASCTIME_R
243# ifndef _PTHREADS_DRAFT4
244 extern char *asctime_r(const __struct_tm *, char *);
245# else /* _PTHREADS_DRAFT4 */
246 extern int asctime_r(const __struct_tm *, char *, int);
247# endif /* _PTHREADS_DRAFT4 */
248# endif
249# ifndef _CTIME_R
250# define _CTIME_R
251# ifndef _PTHREADS_DRAFT4
252 extern char *ctime_r(const __time_t *, char *);
253# else /* _PTHREADS_DRAFT4 */
254 extern int ctime_r(const __time_t *, char *, int);
255# endif /* _PTHREADS_DRAFT4 */
256# endif
257# ifndef _GMTIME_R
258# define _GMTIME_R
259# ifndef _PTHREADS_DRAFT4
260 extern __struct_tm *gmtime_r(const __time_t *, __struct_tm *);
261# else /* _PTHREADS_DRAFT4 */
262 extern int gmtime_r(const __time_t *, __struct_tm *);
263# endif /* _PTHREADS_DRAFT4 */
264# endif
265# ifndef _LOCALTIME_R
266# define _LOCALTIME_R
267# ifndef _PTHREADS_DRAFT4
268 extern __struct_tm *localtime_r(const __time_t *, __struct_tm *);
269# else /* _PTHREADS_DRAFT4 */
270 extern int localtime_r(const __time_t *, __struct_tm *);
271# endif /* _PTHREADS_DRAFT4 */
272# endif
273# endif
274# else /* not _PROTOTYPES */
275
276# ifndef _DIFFTIME
277# define _DIFFTIME
278 extern double difftime();
279# endif
280
281# ifndef _MKTIME
282# define _MKTIME
283# ifdef _HP_SHLIB_CALLS
284# pragma HP_DEFINED_EXTERNAL mktime
285# endif /* _HP_SHLIB_CALLS */
286# ifdef _FAST_SHLIB_CALLS
287# pragma HP_NO_RELOCATION mktime
288# pragma HP_LONG_RETURN mktime
289# endif /* _FAST_SHLIB_CALLS */
290 extern time_t mktime();
291# endif
292
293# ifndef _TIME
294# define _TIME
295# ifdef _HP_SHLIB_CALLS
296# pragma HP_DEFINED_EXTERNAL time
297# endif /* _HP_SHLIB_CALLS */
298# ifdef _FAST_SHLIB_CALLS
299# pragma HP_NO_RELOCATION time
300# pragma HP_LONG_RETURN time
301# endif /* _FAST_SHLIB_CALLS */
302 extern time_t time();
303# endif
304
305# ifndef _ASCTIME
306# define _ASCTIME
307 extern char *asctime();
308# endif
309
310# ifndef _CTIME
311# define _CTIME
312 extern char *ctime();
313# endif
314
315# ifndef _GMTIME
316# define _GMTIME
317 extern struct tm *gmtime();
318# endif
319
320# ifndef _LOCALTIME
321# define _LOCALTIME
322 extern struct tm *localtime();
323# endif
324
325# ifndef _STRFTIME
326# define _STRFTIME
327# ifdef _HP_SHLIB_CALLS
328# pragma HP_DEFINED_EXTERNAL strftime
329# endif /* _HP_SHLIB_CALLS */
330# ifdef _FAST_SHLIB_CALLS
331# pragma HP_NO_RELOCATION strftime
332# pragma HP_LONG_RETURN strftime
333# endif /* _FAST_SHLIB_CALLS */
334 extern size_t strftime();
335# endif
336
337# ifdef _REENTRANT
338
339# ifndef _ASCTIME_R
340# define _ASCTIME_R
341# ifndef _PTHREADS_DRAFT4
342 extern char *asctime_r();
343# else /* _PTHREADS_DRAFT4 */
344 extern int asctime_r();
345# endif /* _PTHREADS_DRAFT4 */
346# endif
347
348# ifndef _CTIME_R
349# define _CTIME_R
350# ifndef _PTHREADS_DRAFT4
351 extern char *ctime_r();
352# else /* _PTHREADS_DRAFT4 */
353 extern int ctime_r();
354# endif /* _PTHREADS_DRAFT4 */
355# endif
356
357# ifndef _GMTIME_R
358# define _GMTIMRE_R
359# ifndef _PTHREADS_DRAFT4
360 extern struct tm *gmtime_r();
361# else /* _PTHREADS_DRAFT4 */
362 extern int gmtime_r();
363# endif /* _PTHREADS_DRAFT4 */
364# endif
365
366# ifndef _LOCALTIME_R
367# define _LOCALTIME_R
368# ifndef _PTHREADS_DRAFT4
369 extern struct tm *localtime_r();
370# else /* _PTHREADS_DRAFT4 */
371 extern int localtime_r();
372# endif /* _PTHREADS_DRAFT4 */
373# endif
374
375# endif
376# endif /* not _PROTOTYPES */
377
378# ifdef _CLASSIC_ANSI_TYPES
379
380# ifndef _CLOCK
381# ifndef __LP64__
382# define _CLOCK
383# if defined(__ia64)
384 /* pragmas needed to support -B protected */
385# pragma extern clock
386# endif /* __ia64 */
387# ifdef _HP_SHLIB_CALLS
388# pragma HP_DEFINED_EXTERNAL clock
389# endif /* _HP_SHLIB_CALLS */
390# ifdef _FAST_SHLIB_CALLS
391# pragma HP_NO_RELOCATION clock
392# pragma HP_LONG_RETURN clock
393# endif /* _FAST_SHLIB_CALLS */
394 extern long clock();
395# endif /* !__LP64 */
396# endif /* !_CLOCK */
397
398# else /* not _CLASSIC_ANSI_TYPES */
399# if defined(__ia64)
400 /* pragmas needed to support -B protected */
401# pragma extern clock
402# endif /* __ia64 */
403# ifdef _PROTOTYPES
404# ifndef _CLOCK
405# define _CLOCK
406# ifdef _HP_SHLIB_CALLS
407# pragma HP_DEFINED_EXTERNAL clock
408# endif /* _HP_SHLIB_CALLS */
409# ifdef _FAST_SHLIB_CALLS
410# pragma HP_NO_RELOCATION clock
411# pragma HP_LONG_RETURN clock
412# endif /* _FAST_SHLIB_CALLS */
413_NAMESPACE_STD_START
414 extern clock_t clock(void);
415_NAMESPACE_STD_END
416# endif
417# else /* not _PROTOTYPES */
418# ifndef _CLOCK
419# define _CLOCK
420 extern clock_t clock();
421# endif
422# endif /* not _PROTOTYPES */
423# endif /* not _CLASSIC_ANSI_TYPES */
424#endif /* _INCLUDE__STDC__ */
425
426#ifdef _INCLUDE_POSIX_SOURCE
427
428#if defined(__ia64)
429 /* pragmas needed to support -B protected */
430# ifndef _TZSET
431# pragma extern tzset
432# endif /* _TZSET */
433# ifndef _TZNAME
434# pragma extern tzname
435# endif /* _TZNAME */
436#endif /* __ia64 */
437
438# ifdef _PROTOTYPES
439
440# ifndef _TZSET
441# define _TZSET
442 extern void tzset(void);
443# endif
444
445# else /* not _PROTOTYPES */
446
447# ifndef _TZSET
448# define _TZSET
449 extern void tzset();
450# endif
451
452# endif /* not _PROTOTYPES */
453
454# ifndef _TZNAME
455# define _TZNAME
456 extern char *tzname[2];
457# endif
458
459#endif /* _INCLUDE_POSIX_SOURCE */
460
461#ifdef _INCLUDE_XOPEN_SOURCE
462
463# if defined(__ia64)
464 /* pragmas needed to support -B protected */
465# ifndef _STRPTIME
466# pragma extern strptime
467# endif /* _STRPTIME */
468# ifndef _TIMEZONE
469# pragma extern timezone
470# endif /* _TIMEZONE */
471# ifndef _DAYLIGHT
472# pragma extern daylight
473# endif /* _DAYLIGHT */
474# endif /* __ia64 */
475# ifdef _HP_SHLIB_CALLS
476# pragma HP_DEFINED_EXTERNAL strptime
477# endif /* _HP_SHLIB_CALLS */
478# ifdef _FAST_SHLIB_CALLS
479# pragma HP_NO_RELOCATION strptime
480# pragma HP_LONG_RETURN strptime
481# endif /* _FAST_SHLIB_CALLS */
482
483# ifdef _PROTOTYPES
484
485# ifndef _STRPTIME
486# define _STRPTIME
487 extern char *strptime(const char *, const char *, __struct_tm *);
488# endif
489
490# else /* not _PROTOTYPES */
491
492# ifndef _STRPTIME
493# define _STRPTIME
494 extern char *strptime();
495# endif
496
497# endif /* not _PROTOTYPES */
498
499# ifndef _TIMEZONE
500# define _TIMEZONE
501 extern long timezone;
502# endif
503
504# ifndef _DAYLIGHT
505# define _DAYLIGHT
506 extern int daylight;
507# endif
508
509#endif /* _INCLUDE_XOPEN_SOURCE */
510
511#ifdef _INCLUDE_XOPEN_SOURCE_EXTENDED
512# if defined(__ia64)
513 /* pragmas needed to support -B protected */
514# ifndef _GETDATE
515# pragma extern getdate
516# endif /* _GETDATE */
517# endif /* __ia64 */
518# ifdef _HP_SHLIB_CALLS
519# pragma HP_DEFINED_EXTERNAL getdate
520# endif /* _HP_SHLIB_CALLS */
521# ifdef _FAST_SHLIB_CALLS
522# pragma HP_NO_RELOCATION getdate
523# pragma HP_LONG_RETURN getdate
524# endif /* _FAST_SHLIB_CALLS */
525# ifdef _PROTOTYPES
526
527# ifndef _GETDATE
528# define _GETDATE
529 extern __struct_tm *getdate(const char *);
530# endif
531
532# else /* !_PROTOTYPES */
533
534# ifndef _GETDATE
535# define _GETDATE
536 extern struct tm *getdate();
537# endif
538
539# endif /* !_PROTOTYPES */
540
541# ifndef _GETDATE_ERR
542# define _GETDATE_ERR
543# if defined(_REENTRANT) && !defined(_PTHREADS_DRAFT4)
544# if defined(__ia64)
545 /* pragmas needed to support -B protected */
546# pragma extern __getdate_error
547# endif /* __ia64 */
548
549# ifdef _HP_SHLIB_CALLS
550# pragma HP_DEFINED_EXTERNAL __getdate_error
551# endif /* _HP_SHLIB_CALLS */
552# ifdef _FAST_SHLIB_CALLS
553# pragma HP_NO_RELOCATION __getdate_error
554# pragma HP_LONG_RETURN __getdate_error
555# endif /* _FAST_SHLIB_CALLS */
556 int * __getdate_error __((void)) ;
557 #define getdate_err (*__getdate_error())
558#else
559# if defined(__ia64)
560 /* pragmas needed to support -B protected */
561# pragma extern getdate_err
562# endif /* __ia64 */
563
564 extern int getdate_err;
565#endif /* defined(_REENTRANT) && !defined(_PTHREADS_DRAFT4) */
566# endif
567
568#endif /* _INCLUDE_XOPEN_SOURCE_EXTENDED */
569
570#ifdef _INCLUDE_HPUX_SOURCE
571
572# ifndef _GET_EXPIRATION_TIME
573# define _GET_EXPIRATION_TIME
574# if defined(__ia64)
575 /* pragmas needed to support -B protected */
576# pragma extern get_expiration_time
577# endif /* __ia64 */
578# ifdef _HP_SHLIB_CALLS
579# pragma HP_DEFINED_EXTERNAL get_expiration_time
580# endif /* _HP_SHLIB_CALLS */
581# ifdef _FAST_SHLIB_CALLS
582# pragma HP_NO_RELOCATION get_expiration_time
583# pragma HP_LONG_RETURN get_expiration_time
584# endif /* _FAST_SHLIB_CALLS */
585 extern int get_expiration_time __((struct timespec *,struct timespec *));
586# endif
587
588# ifdef _PTHREADS_DRAFT4
589
590# if defined(__ia64)
591 /* pragmas needed to support -B protected */
592# pragma extern getdate_r
593# endif /* __ia64 */
594
595# ifdef _PROTOTYPES
596
597# ifndef _GETDATE_R
598# define _GETDATE_R
599 extern int getdate_r(const char *, __struct_tm *, int *);
600# endif
601
602# else /* !_PROTOTYPES */
603
604# ifndef _GETDATE_R
605# define _GETDATE_R
606 extern int getdate_r();
607# endif
608
609# endif /* !_PROTOTYPES */
610# endif /* _PTHREADS_DRAFT4 */
611#endif /* _INCLUDE_HPUX_SOURCE */
612
613#ifdef __cplusplus
614 }
615#endif /* __cplusplus */
616#endif /* not _KERNEL */
617
618# endif /* _INCLUDE_HPUX_SOURCE */
619
620#endif /* _TIME_INCLUDED */