home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / gcc / ixemulsrc.lha / ixemul / include / tzfile.h < prev    next >
C/C++ Source or Header  |  1996-12-11  |  5KB  |  171 lines

  1. #ifndef TZFILE_H
  2.  
  3. #define TZFILE_H
  4.  
  5. /*
  6. ** This header is for use ONLY with the time conversion code.
  7. ** There is no guarantee that it will remain unchanged,
  8. ** or that it will remain at all.
  9. ** Do NOT copy it to any system include directory.
  10. ** Thank you!
  11. */
  12.  
  13. /*
  14. ** Information about time zone files.
  15. */
  16.  
  17. #ifndef TZDIR
  18. #define TZDIR    "/etc/zoneinfo" /* Time zone object file directory */
  19. #endif /* !defined TZDIR */
  20.  
  21. #ifndef TZDEFAULT
  22. #define TZDEFAULT    "localtime"
  23. #endif /* !defined TZDEFAULT */
  24.  
  25. #ifndef TZDEFRULES
  26. #define TZDEFRULES    "posixrules"
  27. #endif /* !defined TZDEFRULES */
  28.  
  29. /*
  30. ** Each file begins with. . .
  31. */
  32.  
  33. struct tzhead {
  34.     char    tzh_reserved[20];    /* reserved for future use */
  35.     char    tzh_ttisgmtcnt[4];    /* coded number of trans. time flags */
  36.     char    tzh_ttisstdcnt[4];    /* coded number of trans. time flags */
  37.     char    tzh_leapcnt[4];        /* coded number of leap seconds */
  38.     char    tzh_timecnt[4];        /* coded number of transition times */
  39.     char    tzh_typecnt[4];        /* coded number of local time types */
  40.     char    tzh_charcnt[4];        /* coded number of abbr. chars */
  41. };
  42.  
  43. /*
  44. ** . . .followed by. . .
  45. **
  46. **    tzh_timecnt (char [4])s        coded transition times a la time(2)
  47. **    tzh_timecnt (unsigned char)s    types of local time starting at above
  48. **    tzh_typecnt repetitions of
  49. **        one (char [4])        coded GMT offset in seconds
  50. **        one (unsigned char)    used to set tm_isdst
  51. **        one (unsigned char)    that's an abbreviation list index
  52. **    tzh_charcnt (char)s        '\0'-terminated zone abbreviations
  53. **    tzh_leapcnt repetitions of
  54. **        one (char [4])        coded leap second transition times
  55. **        one (char [4])        total correction after above
  56. **    tzh_ttisstdcnt (char)s        indexed by type; if TRUE, transition
  57. **                    time is standard time, if FALSE,
  58. **                    transition time is wall clock time
  59. **                    if absent, transition times are
  60. **                    assumed to be wall clock time
  61. **    tzh_ttisgmtcnt (char)s        indexed by type; if TRUE, transition
  62. **                    time is GMT, if FALSE,
  63. **                    transition time is local time
  64. **                    if absent, transition times are
  65. **                    assumed to be local time
  66. */
  67.  
  68. /*
  69. ** In the current implementation, "tzset()" refuses to deal with files that
  70. ** exceed any of the limits below.
  71. */
  72.  
  73. #ifndef TZ_MAX_TIMES
  74. /*
  75. ** The TZ_MAX_TIMES value below is enough to handle a bit more than a
  76. ** year's worth of solar time (corrected daily to the nearest second) or
  77. ** 138 years of Pacific Presidential Election time
  78. ** (where there are three time zone transitions every fourth year).
  79. */
  80. #define TZ_MAX_TIMES    370
  81. #endif /* !defined TZ_MAX_TIMES */
  82.  
  83. #ifndef TZ_MAX_TYPES
  84. #ifndef NOSOLAR
  85. #define TZ_MAX_TYPES    256 /* Limited by what (unsigned char)'s can hold */
  86. #endif /* !defined NOSOLAR */
  87. #ifdef NOSOLAR
  88. /*
  89. ** Must be at least 14 for Europe/Riga as of Jan 12 1995,
  90. ** as noted by Earl Chew <earl@hpato.aus.hp.com>.
  91. */
  92. #define TZ_MAX_TYPES    20    /* Maximum number of local time types */
  93. #endif /* !defined NOSOLAR */
  94. #endif /* !defined TZ_MAX_TYPES */
  95.  
  96. #ifndef TZ_MAX_CHARS
  97. #define TZ_MAX_CHARS    50    /* Maximum number of abbreviation characters */
  98.                 /* (limited by what unsigned chars can hold) */
  99. #endif /* !defined TZ_MAX_CHARS */
  100.  
  101. #ifndef TZ_MAX_LEAPS
  102. #define TZ_MAX_LEAPS    50    /* Maximum number of leap second corrections */
  103. #endif /* !defined TZ_MAX_LEAPS */
  104.  
  105. #define SECSPERMIN    60
  106. #define MINSPERHOUR    60
  107. #define HOURSPERDAY    24
  108. #define DAYSPERWEEK    7
  109. #define DAYSPERNYEAR    365
  110. #define DAYSPERLYEAR    366
  111. #define SECSPERHOUR    (SECSPERMIN * MINSPERHOUR)
  112. #define SECSPERDAY    ((long) SECSPERHOUR * HOURSPERDAY)
  113. #define MONSPERYEAR    12
  114.  
  115. #define TM_SUNDAY    0
  116. #define TM_MONDAY    1
  117. #define TM_TUESDAY    2
  118. #define TM_WEDNESDAY    3
  119. #define TM_THURSDAY    4
  120. #define TM_FRIDAY    5
  121. #define TM_SATURDAY    6
  122.  
  123. #define TM_JANUARY    0
  124. #define TM_FEBRUARY    1
  125. #define TM_MARCH    2
  126. #define TM_APRIL    3
  127. #define TM_MAY        4
  128. #define TM_JUNE        5
  129. #define TM_JULY        6
  130. #define TM_AUGUST    7
  131. #define TM_SEPTEMBER    8
  132. #define TM_OCTOBER    9
  133. #define TM_NOVEMBER    10
  134. #define TM_DECEMBER    11
  135.  
  136. #define TM_YEAR_BASE    1900
  137.  
  138. #define EPOCH_YEAR    1970
  139. #define EPOCH_WDAY    TM_THURSDAY
  140.  
  141. /*
  142. ** Accurate only for the past couple of centuries;
  143. ** that will probably do.
  144. */
  145.  
  146. #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
  147.  
  148. #ifndef USG
  149.  
  150. /*
  151. ** Use of the underscored variants may cause problems if you move your code to
  152. ** certain System-V-based systems; for maximum portability, use the
  153. ** underscore-free variants.  The underscored variants are provided for
  154. ** backward compatibility only; they may disappear from future versions of
  155. ** this file.
  156. */
  157.  
  158. #define SECS_PER_MIN    SECSPERMIN
  159. #define MINS_PER_HOUR    MINSPERHOUR
  160. #define HOURS_PER_DAY    HOURSPERDAY
  161. #define DAYS_PER_WEEK    DAYSPERWEEK
  162. #define DAYS_PER_NYEAR    DAYSPERNYEAR
  163. #define DAYS_PER_LYEAR    DAYSPERLYEAR
  164. #define SECS_PER_HOUR    SECSPERHOUR
  165. #define SECS_PER_DAY    SECSPERDAY
  166. #define MONS_PER_YEAR    MONSPERYEAR
  167.  
  168. #endif /* !defined USG */
  169.  
  170. #endif /* !defined TZFILE_H */
  171.