Annotation of researchv10no/cmd/odist/pax/include/tm.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Glenn Fowler
                      3:  * AT&T Bell Laboratories
                      4:  *
                      5:  * time conversion support definitions
                      6:  */
                      7: 
                      8: #ifndef TM_DEFAULT
                      9: 
                     10: #define tm_data                _tm_data_
                     11: #define tm_info                _tm_info_
                     12: 
                     13: #include <time.h>
                     14: #ifndef LS_USER
                     15: #include <sys/types.h>
                     16: #endif
                     17: 
                     18: #define tmset()                do{if(!tm_info.local.standard)tminit();}while(0)
                     19: 
                     20: #ifndef VOID
                     21: #define VOID   char
                     22: #endif
                     23: 
                     24: #define TM_ADJUST      (1<<0)          /* local doesn't do leap secs   */
                     25: #define TM_LEAP                (1<<1)          /* do leap seconds              */
                     26: #define TM_UTC         (1<<2)          /* universal coordinated ref    */
                     27: 
                     28: #define TM_DST         (-60)           /* default minutes for DST      */
                     29: #define TM_LOCALZONE   (25 * 60)       /* use local time zone offset   */
                     30: #define TM_MAXLEAP     1               /* max leap secs per leap       */
                     31: 
                     32: /*
                     33:  * these indices must agree with tm_dform[]
                     34:  */
                     35: 
                     36: #define TM_MONTH_3     0
                     37: #define TM_MONTH       12
                     38: #define TM_DAY_3       24
                     39: #define TM_DAY         31
                     40: #define TM_TIME                38
                     41: #define TM_DATE                39
                     42: #define TM_DEFAULT     40
                     43: #define TM_MERIDIAN    41
                     44: 
                     45: #define TM_UT          43
                     46: #define TM_DT          47
                     47: #define TM_SUFFIXES    51
                     48: #define TM_PARTS       55
                     49: #define TM_HOURS       62
                     50: #define TM_DAYS                66
                     51: #define TM_LAST                69
                     52: #define TM_THIS                72
                     53: #define TM_NEXT                75
                     54: #define TM_EXACT       78
                     55: #define TM_NOISE       81
                     56: 
                     57: #define TM_NFORM       85
                     58: 
                     59: struct tl                              /* leap second info             */
                     60: {
                     61:        time_t          time;           /* the leap second event        */
                     62:        int             total;          /* inclusive total since epoch  */
                     63: };
                     64: 
                     65: struct tz                              /* time zone info               */
                     66: {
                     67:        char*           type;           /* type name                    */
                     68:        char*           standard;       /* standard time name           */
                     69:        char*           daylight;       /* daylight or summertime name  */
                     70:        short           west;           /* minutes west of GMT          */
                     71:        short           dst;            /* add to tz.west for DST       */
                     72: };
                     73: 
                     74: struct tmdata                          /* tm library readonly data     */
                     75: {
                     76:        char**          format;         /* default TM_* format strings  */
                     77:        char*           lex;            /* format lex type classes      */
                     78:        char*           digit;          /* output digits                */
                     79:        short*          days;           /* days in month i              */
                     80:        short*          sum;            /* days in months before i      */
                     81:        struct tl*      leap;           /* leap second table            */
                     82:        struct tz*      zone;           /* alternate timezone table     */
                     83: };
                     84: 
                     85: struct tminfo                          /* tm library global info       */
                     86: {
                     87:        char*           deformat;       /* TM_DEFAULT override          */
                     88:        int             flags;          /* flags                        */
                     89:        char**          format;         /* current format strings       */
                     90:        struct tz       local;          /* local timezone               */
                     91: };
                     92: 
                     93: #if __cplusplus
                     94: extern "C" {
                     95: #endif
                     96: 
                     97: extern struct tmdata   tm_data;
                     98: extern struct tminfo   tm_info;
                     99: 
                    100: #if __cplusplus
                    101: }
                    102: #endif
                    103: 
                    104: #if __STDC__ || __cplusplus || c_plusplus
                    105: #if __cplusplus
                    106: extern "C" {
                    107: #endif
                    108: extern time_t          time(time_t*);
                    109: 
                    110: extern time_t          tmdate(const char*, char**, time_t*);
                    111: extern struct tm*      tmfix(struct tm*);
                    112: extern char*           tmform(char*, const char*, time_t*);
                    113: extern int             tmgoff(const char*, char**, int);
                    114: extern void            tminit(void);
                    115: extern time_t          tmleap(time_t*);
                    116: extern int             tmlex(const char*, char**, char**, int, char**, int);
                    117: extern struct tm*      tmmake(time_t*);
                    118: extern char*           tmpoff(char*, const char*, int, int);
                    119: extern time_t          tmtime(struct tm*, int);
                    120: extern char*           tmtype(const char*, char**);
                    121: extern int             tmword(const char*, char**, const char*, char**, int);
                    122: extern int             tmzone(const char*, char**, const char*, int*);
                    123: #if __cplusplus
                    124: }
                    125: #endif
                    126: #else
                    127: extern time_t          time();
                    128: 
                    129: extern time_t          tmdate();
                    130: extern struct tm*      tmfix();
                    131: extern char*           tmform();
                    132: extern int             tmgoff();
                    133: extern void            tminit();
                    134: extern time_t          tmleap();
                    135: extern int             tmlex();
                    136: extern struct tm*      tmmake();
                    137: extern char*           tmpoff();
                    138: extern time_t          tmtime();
                    139: extern char*           tmtype();
                    140: extern int             tmword();
                    141: extern int             tmzone();
                    142: #endif
                    143: 
                    144: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.