2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: tmdata.c /main/3 1995/11/01 18:53:32 rswiston $ */
24 /***************************************************************
26 * AT&T - PROPRIETARY *
28 * THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
31 * Copyright (c) 1995 AT&T Corp. *
32 * All Rights Reserved *
34 * This software is licensed by AT&T Corp. *
35 * under the terms and conditions of the license in *
36 * http://www.research.att.com/orgs/ssr/book/reuse *
38 * This software was created by the *
39 * Software Engineering Research Department *
40 * AT&T Bell Laboratories *
42 * For further information contact *
43 * gsf@research.att.com *
45 ***************************************************************/
47 /* : : generated by proto : : */
49 #if !defined(__PROTO__)
50 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
51 #if defined(__cplusplus)
52 #define __MANGLE__ "C"
57 #define __PROTO__(x) x
59 #define __PARAM__(n,o) n
60 #if !defined(__STDC__) && !defined(__cplusplus)
61 #if !defined(c_plusplus)
72 #define __PROTO__(x) ()
73 #define __OTORP__(x) x
74 #define __PARAM__(n,o) o
82 #if defined(__cplusplus) || defined(c_plusplus)
83 #define __VARARG__ ...
87 #if defined(__STDARG__)
88 #define __VA_START__(p,a) va_start(p,a)
90 #define __VA_START__(p,a) va_start(p)
97 * default format strings -- must agree with TM_* indices
100 static char* format[] =
102 "Jan", "Feb", "Mar", "Apr",
103 "May", "Jun", "Jul", "Aug",
104 "Sep", "Oct", "Nov", "Dec",
106 "January", "February", "March", "April",
107 "May", "June", "July", "August",
108 "September", "October", "November", "December",
110 "Sun", "Mon", "Tue", "Wed",
113 "Sunday", "Monday", "Tuesday", "Wednesday",
114 "Thursday", "Friday", "Saturday",
116 "%H:%M:%S", "%m/%d/%y", "%a %b %e %T %Z %Y",
120 "GMT", "UTC", "UCT", "CUT",
126 "second", "minute", "hour", "day",
127 "week", "month", "year",
129 "midnight", "morning", "noon", "evening",
131 "yesterday", "today", "tomorrow",
133 "last", "ago", "past",
134 "this", "now", "current",
135 "in", "next", "hence",
142 * format[] lex type classes
147 TM_MONTH_3, TM_MONTH_3, TM_MONTH_3, TM_MONTH_3,
148 TM_MONTH_3, TM_MONTH_3, TM_MONTH_3, TM_MONTH_3,
149 TM_MONTH_3, TM_MONTH_3, TM_MONTH_3, TM_MONTH_3,
151 TM_MONTH, TM_MONTH, TM_MONTH, TM_MONTH,
152 TM_MONTH, TM_MONTH, TM_MONTH, TM_MONTH,
153 TM_MONTH, TM_MONTH, TM_MONTH, TM_MONTH,
155 TM_DAY_3, TM_DAY_3, TM_DAY_3, TM_DAY_3,
156 TM_DAY_3, TM_DAY_3, TM_DAY_3,
158 TM_DAY, TM_DAY, TM_DAY, TM_DAY,
159 TM_DAY, TM_DAY, TM_DAY,
161 TM_TIME, TM_DATE, TM_DEFAULT,
163 TM_MERIDIAN, TM_MERIDIAN,
165 TM_UT, TM_UT, TM_UT, TM_UT,
166 TM_DT, TM_DT, TM_DT, TM_DT,
168 TM_SUFFIXES, TM_SUFFIXES, TM_SUFFIXES, TM_SUFFIXES,
170 TM_PARTS, TM_PARTS, TM_PARTS, TM_PARTS,
171 TM_PARTS, TM_PARTS, TM_PARTS,
173 TM_HOURS, TM_HOURS, TM_HOURS, TM_HOURS,
175 TM_DAYS, TM_DAYS, TM_DAYS,
177 TM_LAST, TM_LAST, TM_LAST,
178 TM_THIS, TM_THIS, TM_THIS,
179 TM_NEXT, TM_NEXT, TM_NEXT,
180 TM_EXACT, TM_EXACT, TM_EXACT,
182 TM_NOISE, TM_NOISE, TM_NOISE, TM_NOISE,
186 * output format digits
189 static char digit[] = "0123456789";
192 * number of days in month i
195 static short days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
198 * sum of days in months before month i
201 static short sum[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
204 * leap second time_t and accumulated adjustments
205 * (reverse order -- biased for recent dates)
207 * tl.time is the seconds since the epoch for the leap event
209 * adding: the first additional second
210 * subtracting: the first dissappearing second
213 static Tm_leap_t leap[] =
215 741484817, 18, /* Jun 30 23:59:60 GMT 1993 */
216 709948816, 17, /* Jun 30 23:59:60 GMT 1992 */
217 662688015, 16, /* Dec 31 23:59:60 GMT 1990 */
218 631152014, 15, /* Dec 31 23:59:60 GMT 1989 */
219 567993613, 14, /* Dec 31 23:59:60 GMT 1987 */
220 489024012, 13, /* Jun 30 23:59:60 GMT 1985 */
221 425865611, 12, /* Jun 30 23:59:60 GMT 1983 */
222 394329610, 11, /* Jun 30 23:59:60 GMT 1982 */
223 362793609, 10, /* Jun 30 23:59:60 GMT 1981 */
224 315532808, 9, /* Dec 31 23:59:60 GMT 1979 */
225 283996807, 8, /* Dec 31 23:59:60 GMT 1978 */
226 252460806, 7, /* Dec 31 23:59:60 GMT 1977 */
227 220924805, 6, /* Dec 31 23:59:60 GMT 1976 */
228 189302404, 5, /* Dec 31 23:59:60 GMT 1975 */
229 157766403, 4, /* Dec 31 23:59:60 GMT 1974 */
230 126230402, 3, /* Dec 31 23:59:60 GMT 1973 */
231 94694401, 2, /* Dec 31 23:59:60 GMT 1972 */
232 78796800, 1, /* Jun 30 23:59:60 GMT 1972 */
233 0, 0, /* can reference (tl+1) */
240 * the UTC entries must be first
242 * zones with the same type are contiguous with all but the
243 * first entry for the type having a null type
245 * tz.standard is the sentinel
248 static Tm_zone_t zone[] =
250 0, "GMT", 0, ( 0 * 60), 0, /* UTC */
251 0, "UCT", 0, ( 0 * 60), 0, /* UTC */
252 0, "UTC", 0, ( 0 * 60), 0, /* UTC */
253 0, "CUT", 0, ( 0 * 60), 0, /* UTC */
254 "USA", "HST", 0, (10 * 60), 0, /* Hawaii */
255 0, "YST", "YDT", ( 9 * 60), TM_DST, /* Yukon */
256 0, "PST", "PDT", ( 8 * 60), TM_DST, /* Pacific */
257 0, "PST", "PPET", ( 8 * 60), TM_DST, /* Pacific pres elect */
258 0, "MST", "MDT", ( 7 * 60), TM_DST, /* Mountain */
259 0, "CST", "CDT", ( 6 * 60), TM_DST, /* Central */
260 0, "EST", "EDT", ( 5 * 60), TM_DST, /* Eastern */
261 "CAN", "AST", "ADT", ( 4 * 60), TM_DST, /* Atlantic */
262 0, "NST", 0, ( 3 * 60 + 30), 0, /* Newfoundland */
263 "GBR", "", "BST", ( 0 * 60), TM_DST, /* British Summer */
264 "EUR", "WET", 0, ( 0 * 60), TM_DST, /* Western Eurpoean */
265 0, "CET", 0, -( 1 * 60), TM_DST, /* Central European */
266 0, "MET", 0, -( 1 * 60), TM_DST, /* Middle European */
267 0, "EET", 0, -( 2 * 60), TM_DST, /* Eastern Eurpoean */
268 "ISR", "IST", "IDT", -( 3 * 60), TM_DST, /* Israel */
269 "IND", "IST", 0, -( 5 * 60 + 30 ), 0, /* India */
270 "CHN", "HKT", 0, -( 8 * 60), 0, /* Hong Kong */
271 "KOR", "KST", "KDT", -( 8 * 60), TM_DST, /* Korea */
272 "SNG", "SST", 0, -( 8 * 60), 0, /* Singapore */
273 "JPN", "JST", 0, -( 9 * 60), 0, /* Japan */
274 "AUS", "AWST", 0, -( 8 * 60), 0, /* Australia Western */
275 0, "WST", 0, -( 8 * 60), 0, /* Australia Western */
276 0, "ACST", 0, -( 9 * 60 + 30),TM_DST, /* Australia Central */
277 0, "CST", 0, -( 9 * 60 + 30),TM_DST, /* Australia Central */
278 0, "AEST", 0, -(10 * 60), TM_DST, /* Australia Eastern */
279 0, "EST", 0, -(10 * 60), TM_DST, /* Australia Eastern */
280 "NZL", "NZST", "NZDT", -(12 * 60), TM_DST, /* New Zealand */
284 #if _DLL_INDIRECT_DATA && !_DLL
285 static Tm_data_t tm_data_data =
290 { format, lex, digit, days, sum, leap, zone };
292 #if _DLL_INDIRECT_DATA && !_DLL
293 Tm_data_t tm_data = &tm_data_data;