xref: /titanic_50/usr/src/lib/libast/sparc/include/ast/tm.h (revision 408aef6a222bf32dc7e66db1ff562316a425ee72)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2008 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 
106 #define TM_NFORM		129
107 
108 typedef struct				/* leap second info		*/
109 {
110 	time_t		time;		/* the leap second event	*/
111 	int		total;		/* inclusive total since epoch	*/
112 } Tm_leap_t;
113 
114 typedef struct				/* time zone info		*/
115 {
116 	char*		type;		/* type name			*/
117 	char*		standard;	/* standard time name		*/
118 	char*		daylight;	/* daylight or summertime name	*/
119 	short		west;		/* minutes west of GMT		*/
120 	short		dst;		/* add to tz.west for DST	*/
121 } Tm_zone_t;
122 
123 typedef struct				/* tm library readonly data	*/
124 {
125 	char**		format;		/* default TM_* format strings	*/
126 	char*		lex;		/* format lex type classes	*/
127 	char*		digit;		/* output digits		*/
128 	short*		days;		/* days in month i		*/
129 	short*		sum;		/* days in months before i	*/
130 	Tm_leap_t*	leap;		/* leap second table		*/
131 	Tm_zone_t*	zone;		/* alternate timezone table	*/
132 } Tm_data_t;
133 
134 typedef struct				/* tm library global info	*/
135 {
136 	char*		deformat;	/* TM_DEFAULT override		*/
137 	int		flags;		/* flags			*/
138 	char**		format;		/* current format strings	*/
139 	Tm_zone_t*	date;		/* timezone from last tmdate()	*/
140 	Tm_zone_t*	local;		/* local timezone		*/
141 	Tm_zone_t*	zone;		/* current timezone		*/
142 } Tm_info_t;
143 
144 typedef struct Tm_s
145 {
146 	int			tm_sec;
147 	int			tm_min;
148 	int			tm_hour;
149 	int			tm_mday;
150 	int			tm_mon;
151 	int			tm_year;
152 	int			tm_wday;
153 	int			tm_yday;
154 	int			tm_isdst;
155 	uint32_t		tm_nsec;
156 	Tm_zone_t*		tm_zone;
157 } Tm_t;
158 
159 #if _BLD_ast && defined(__EXPORT__)
160 #undef __MANGLE__
161 #define __MANGLE__ __LINKAGE__ __EXPORT__
162 #endif
163 #if !_BLD_ast && defined(__IMPORT__)
164 #undef __MANGLE__
165 #define __MANGLE__ __LINKAGE__ __IMPORT__
166 #endif
167 
168 extern __MANGLE__ Tm_data_t*	_tm_datap_;
169 extern __MANGLE__ Tm_info_t*	_tm_infop_;
170 
171 #define tm_data		(*_tm_datap_)
172 #define tm_info		(*_tm_infop_)
173 
174 #undef __MANGLE__
175 #define __MANGLE__ __LINKAGE__
176 
177 #if _BLD_ast && defined(__EXPORT__)
178 #undef __MANGLE__
179 #define __MANGLE__ __LINKAGE__		__EXPORT__
180 #endif
181 
182 extern __MANGLE__ time_t		tmdate __PROTO__((const char*, char**, time_t*));
183 extern __MANGLE__ int		tmequiv __PROTO__((Tm_t*));
184 extern __MANGLE__ Tm_t*		tmfix __PROTO__((Tm_t*));
185 extern __MANGLE__ char*		tmfmt __PROTO__((char*, size_t, const char*, time_t*));
186 extern __MANGLE__ char*		tmform __PROTO__((char*, const char*, time_t*));
187 extern __MANGLE__ int		tmgoff __PROTO__((const char*, char**, int));
188 extern __MANGLE__ void		tminit __PROTO__((Tm_zone_t*));
189 extern __MANGLE__ time_t		tmleap __PROTO__((time_t*));
190 extern __MANGLE__ int		tmlex __PROTO__((const char*, char**, char**, int, char**, int));
191 extern __MANGLE__ char**		tmlocale __PROTO__((void));
192 extern __MANGLE__ Tm_t*		tmmake __PROTO__((time_t*));
193 extern __MANGLE__ char*		tmpoff __PROTO__((char*, size_t, const char*, int, int));
194 extern __MANGLE__ time_t		tmscan __PROTO__((const char*, char**, const char*, char**, time_t*, long));
195 extern __MANGLE__ int		tmsleep __PROTO__((time_t, time_t));
196 extern __MANGLE__ time_t		tmtime __PROTO__((Tm_t*, int));
197 extern __MANGLE__ Tm_zone_t*	tmtype __PROTO__((const char*, char**));
198 extern __MANGLE__ int		tmweek __PROTO__((Tm_t*, int, int, int));
199 extern __MANGLE__ int		tmword __PROTO__((const char*, char**, const char*, char**, int));
200 extern __MANGLE__ Tm_zone_t*	tmzone __PROTO__((const char*, char**, const char*, int*));
201 
202 #undef __MANGLE__
203 #define __MANGLE__ __LINKAGE__
204 
205 #endif
206