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