tzfile.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* Layout and location of TZif files. */
  2. #ifndef TZFILE_H
  3. #define TZFILE_H
  4. /*
  5. ** This file is in the public domain, so clarified as of
  6. ** 1996-06-05 by Arthur David Olson.
  7. */
  8. /*
  9. ** This header is for use ONLY with the time conversion code.
  10. ** There is no guarantee that it will remain unchanged,
  11. ** or that it will remain at all.
  12. ** Do NOT copy it to any system include directory.
  13. ** Thank you!
  14. */
  15. /*
  16. ** Information about time zone files.
  17. */
  18. #ifndef TZDIR
  19. #define TZDIR "/usr/share/zoneinfo" /* Time zone object file directory */
  20. #endif /* !defined TZDIR */
  21. #ifndef TZDEFAULT
  22. #define TZDEFAULT "/etc/localtime"
  23. #endif /* !defined TZDEFAULT */
  24. #ifndef TZDEFRULES
  25. #define TZDEFRULES "posixrules"
  26. #endif /* !defined TZDEFRULES */
  27. /* See Internet RFC 8536 for more details about the following format. */
  28. /*
  29. ** Each file begins with. . .
  30. */
  31. #define TZ_MAGIC "TZif"
  32. struct tzhead {
  33. char tzh_magic[4]; /* TZ_MAGIC */
  34. char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
  35. char tzh_reserved[15]; /* reserved; must be zero */
  36. char tzh_ttisutcnt[4]; /* coded number of trans. time flags */
  37. char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
  38. char tzh_leapcnt[4]; /* coded number of leap seconds */
  39. char tzh_timecnt[4]; /* coded number of transition times */
  40. char tzh_typecnt[4]; /* coded number of local time types */
  41. char tzh_charcnt[4]; /* coded number of abbr. chars */
  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 UT 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 1, transition
  57. ** time is standard time, if 0,
  58. ** transition time is local (wall clock)
  59. ** time; if absent, transition times are
  60. ** assumed to be local time
  61. ** tzh_ttisutcnt (char)s indexed by type; if 1, transition
  62. ** time is UT, if 0, transition time is
  63. ** local time; if absent, transition
  64. ** times are assumed to be local time.
  65. ** When this is 1, the corresponding
  66. ** std/wall indicator must also be 1.
  67. */
  68. /*
  69. ** If tzh_version is '2' or greater, the above is followed by a second instance
  70. ** of tzhead and a second instance of the data in which each coded transition
  71. ** time uses 8 rather than 4 chars,
  72. ** then a POSIX-TZ-environment-variable-style string for use in handling
  73. ** instants after the last transition time stored in the file
  74. ** (with nothing between the newlines if there is no POSIX representation for
  75. ** such instants).
  76. **
  77. ** If tz_version is '3' or greater, the above is extended as follows.
  78. ** First, the POSIX TZ string's hour offset may range from -167
  79. ** through 167 as compared to the POSIX-required 0 through 24.
  80. ** Second, its DST start time may be January 1 at 00:00 and its stop
  81. ** time December 31 at 24:00 plus the difference between DST and
  82. ** standard time, indicating DST all year.
  83. */
  84. /*
  85. ** In the current implementation, "tzset()" refuses to deal with files that
  86. ** exceed any of the limits below.
  87. */
  88. #ifndef TZ_MAX_TIMES
  89. #define TZ_MAX_TIMES 2000
  90. #endif /* !defined TZ_MAX_TIMES */
  91. #ifndef TZ_MAX_TYPES
  92. /* This must be at least 17 for Europe/Samara and Europe/Vilnius. */
  93. #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
  94. #endif /* !defined TZ_MAX_TYPES */
  95. #ifndef TZ_MAX_CHARS
  96. #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
  97. /* (limited by what unsigned chars can hold) */
  98. #endif /* !defined TZ_MAX_CHARS */
  99. #ifndef TZ_MAX_LEAPS
  100. #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
  101. #endif /* !defined TZ_MAX_LEAPS */
  102. #endif /* !defined TZFILE_H */