xref: /titanic_41/usr/src/lib/libast/amd64/include/ast/tm.h (revision 0a47c91c895e274dd0990009919e30e984364a8b)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                    by AT&T Intellectual Property                     *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 /*
26  * Glenn Fowler
27  * AT&T Research
28  *
29  * time conversion support definitions
30  */
31 
32 #ifndef _TM_H
33 #if !defined(__PROTO__)
34 #include <prototyped.h>
35 #endif
36 #if !defined(__LINKAGE__)
37 #define __LINKAGE__		/* 2004-08-11 transition */
38 #endif
39 
40 #define _TM_H
41 
42 #define TM_VERSION	20070319L
43 
44 #include <ast.h>
45 #include <times.h>
46 
47 #undef	daylight
48 
49 #define tmset(z)	tminit(z)
50 #define tmisleapyear(y)	(!((y)%4)&&(((y)%100)||!((((y)<1900)?((y)+1900):(y))%400)))
51 
52 #define TM_ADJUST	(1<<0)		/* local doesn't do leap secs	*/
53 #define TM_LEAP		(1<<1)		/* do leap seconds		*/
54 #define TM_UTC		(1<<2)		/* universal coordinated ref	*/
55 
56 #define TM_PEDANTIC	(1<<3)		/* pedantic date parse		*/
57 #define TM_DATESTYLE	(1<<4)		/* date(1) style mmddHHMMccyy	*/
58 #define TM_SUBSECOND	(1<<5)		/* <something>%S => ...%S.%P	*/
59 
60 #define TM_DST		(-60)		/* default minutes for DST	*/
61 #define TM_LOCALZONE	(25 * 60)	/* use local time zone offset	*/
62 #define TM_UTCZONE	(26 * 60)	/* UTC "time zone"		*/
63 #define TM_MAXLEAP	1		/* max leap secs per leap	*/
64 #define TM_WINDOW	69		/* century windowing guard year	*/
65 
66 /*
67  * these indices must agree with tm_dform[]
68  */
69 
70 #define TM_MONTH_ABBREV		0
71 #define TM_MONTH		12
72 #define TM_DAY_ABBREV		24
73 #define TM_DAY			31
74 #define TM_TIME			38
75 #define TM_DATE			39
76 #define TM_DEFAULT		40
77 #define TM_MERIDIAN		41
78 
79 #define TM_UT			43
80 #define TM_DT			47
81 #define TM_SUFFIXES		51
82 #define TM_PARTS		55
83 #define TM_HOURS		62
84 #define TM_DAYS			66
85 #define TM_LAST			69
86 #define TM_THIS			72
87 #define TM_NEXT			75
88 #define TM_EXACT		78
89 #define TM_NOISE		81
90 #define TM_ORDINAL		85
91 #define TM_DIGITS		95
92 #define TM_CTIME		105
93 #define TM_DATE_1		106
94 #define TM_INTERNATIONAL	107
95 #define TM_RECENT		108
96 #define TM_DISTANT		109
97 #define TM_MERIDIAN_TIME	110
98 #define TM_ERA			111
99 #define TM_ERA_DATE		112
100 #define TM_ERA_TIME		113
101 #define TM_ERA_DEFAULT		114
102 #define TM_ERA_YEAR		115
103 #define TM_ORDINALS		116
104 #define TM_FINAL		126
105 #define TM_WORK			129
106 
107 #define TM_NFORM		132
108 
109 typedef struct				/* leap second info		*/
110 {
111 	time_t		time;		/* the leap second event	*/
112 	int		total;		/* inclusive total since epoch	*/
113 } Tm_leap_t;
114 
115 typedef struct				/* time zone info		*/
116 {
117 	char*		type;		/* type name			*/
118 	char*		standard;	/* standard time name		*/
119 	char*		daylight;	/* daylight or summertime name	*/
120 	short		west;		/* minutes west of GMT		*/
121 	short		dst;		/* add to tz.west for DST	*/
122 } Tm_zone_t;
123 
124 typedef struct				/* tm library readonly data	*/
125 {
126 	char**		format;		/* default TM_* format strings	*/
127 	unsigned char*	lex;		/* format lex type classes	*/
128 	char*		digit;		/* output digits		*/
129 	short*		days;		/* days in month i		*/
130 	short*		sum;		/* days in months before i	*/
131 	Tm_leap_t*	leap;		/* leap second table		*/
132 	Tm_zone_t*	zone;		/* alternate timezone table	*/
133 } Tm_data_t;
134 
135 typedef struct				/* tm library global info	*/
136 {
137 	char*		deformat;	/* TM_DEFAULT override		*/
138 	int		flags;		/* flags			*/
139 	char**		format;		/* current format strings	*/
140 	Tm_zone_t*	date;		/* timezone from last tmdate()	*/
141 	Tm_zone_t*	local;		/* local timezone		*/
142 	Tm_zone_t*	zone;		/* current timezone		*/
143 } Tm_info_t;
144 
145 typedef struct Tm_s
146 {
147 	int			tm_sec;
148 	int			tm_min;
149 	int			tm_hour;
150 	int			tm_mday;
151 	int			tm_mon;
152 	int			tm_year;
153 	int			tm_wday;
154 	int			tm_yday;
155 	int			tm_isdst;
156 	uint32_t		tm_nsec;
157 	Tm_zone_t*		tm_zone;
158 } Tm_t;
159 
160 #if _BLD_ast && defined(__EXPORT__)
161 #undef __MANGLE__
162 #define __MANGLE__ __LINKAGE__ __EXPORT__
163 #endif
164 #if !_BLD_ast && defined(__IMPORT__)
165 #undef __MANGLE__
166 #define __MANGLE__ __LINKAGE__ __IMPORT__
167 #endif
168 
169 extern __MANGLE__ Tm_data_t*	_tm_datap_;
170 extern __MANGLE__ Tm_info_t*	_tm_infop_;
171 
172 #define tm_data		(*_tm_datap_)
173 #define tm_info		(*_tm_infop_)
174 
175 #undef __MANGLE__
176 #define __MANGLE__ __LINKAGE__
177 
178 #if _BLD_ast && defined(__EXPORT__)
179 #undef __MANGLE__
180 #define __MANGLE__ __LINKAGE__		__EXPORT__
181 #endif
182 
183 extern __MANGLE__ time_t		tmdate __PROTO__((const char*, char**, time_t*));
184 extern __MANGLE__ int		tmequiv __PROTO__((Tm_t*));
185 extern __MANGLE__ Tm_t*		tmfix __PROTO__((Tm_t*));
186 extern __MANGLE__ char*		tmfmt __PROTO__((char*, size_t, const char*, time_t*));
187 extern __MANGLE__ char*		tmform __PROTO__((char*, const char*, time_t*));
188 extern __MANGLE__ int		tmgoff __PROTO__((const char*, char**, int));
189 extern __MANGLE__ void		tminit __PROTO__((Tm_zone_t*));
190 extern __MANGLE__ time_t		tmleap __PROTO__((time_t*));
191 extern __MANGLE__ int		tmlex __PROTO__((const char*, char**, char**, int, char**, int));
192 extern __MANGLE__ char**		tmlocale __PROTO__((void));
193 extern __MANGLE__ Tm_t*		tmmake __PROTO__((time_t*));
194 extern __MANGLE__ char*		tmpoff __PROTO__((char*, size_t, const char*, int, int));
195 extern __MANGLE__ time_t		tmscan __PROTO__((const char*, char**, const char*, char**, time_t*, long));
196 extern __MANGLE__ int		tmsleep __PROTO__((time_t, time_t));
197 extern __MANGLE__ time_t		tmtime __PROTO__((Tm_t*, int));
198 extern __MANGLE__ Tm_zone_t*	tmtype __PROTO__((const char*, char**));
199 extern __MANGLE__ int		tmweek __PROTO__((Tm_t*, int, int, int));
200 extern __MANGLE__ int		tmword __PROTO__((const char*, char**, const char*, char**, int));
201 extern __MANGLE__ Tm_zone_t*	tmzone __PROTO__((const char*, char**, const char*, int*));
202 
203 #undef __MANGLE__
204 #define __MANGLE__ __LINKAGE__
205 
206 #endif
207