timezone.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 2000-Apr-09 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, all these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  7. */
  8. #ifndef __timezone_h
  9. #define __timezone_h
  10. #ifndef IZ_MKTIME_ONLY
  11. /* limits for our timezone info data:
  12. * we support only basic standard and daylight time, with max 2 transitions
  13. * per year, but for the maximum range of years a 32-bit second counter
  14. * can cover (these are 136 years plus a bit more than one month)
  15. */
  16. #define TZ_MAX_TIMES 272 /* (=2*(LastGoodYr + 1 - FirstGoodYr) */
  17. #define TZ_MAX_TYPES 2 /* We only support basic standard and daylight */
  18. #ifdef WIN32 /* Win32 tzinfo supplies at max (2 * 32) chars of tz names */
  19. #define TZ_MAX_CHARS 64 /* Maximum number of abbreviation characters */
  20. #else
  21. #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
  22. #endif
  23. /* supported types of transition rules */
  24. #define JULIAN_DAY 0 /* Jn - Julian day */
  25. #define DAY_OF_YEAR 1 /* n - day of year */
  26. #define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */
  27. struct ttinfo {
  28. long tt_gmtoff; /* UTC offset in seconds */
  29. int tt_isdst; /* used to set tm_isdst */
  30. int tt_abbrind; /* abbreviation list index */
  31. };
  32. struct state {
  33. int timecnt;
  34. int typecnt;
  35. int charcnt;
  36. time_t ats[TZ_MAX_TIMES];
  37. unsigned char types[TZ_MAX_TIMES];
  38. struct ttinfo ttis[TZ_MAX_TYPES];
  39. char chars[TZ_MAX_CHARS];
  40. };
  41. struct rule {
  42. int r_type; /* type of rule--JULIAN_DAY etc */
  43. int r_day; /* day number of rule */
  44. int r_week; /* week number of rule */
  45. int r_mon; /* month number of rule */
  46. long r_time; /* transition time of rule */
  47. };
  48. extern int real_timezone_is_set; /* set by tzset() */
  49. /* prototypes of functions not in time.h */
  50. void __tzset OF((void));
  51. #ifdef NEED__ISINDST
  52. int _isindst OF((struct tm *tb));
  53. #endif
  54. /* callback function to be supplied by the program that uses this library */
  55. int GetPlatformLocalTimezone OF((register struct state * ZCONST sp,
  56. void (*fill_tzstate_from_rules)(struct state * ZCONST sp_res,
  57. ZCONST struct rule * ZCONST start,
  58. ZCONST struct rule * ZCONST end)));
  59. #ifdef IZTZ_SETLOCALTZINFO
  60. void set_TZ OF((long time_zone, int day_light));
  61. #endif
  62. #endif /* !IZ_MKTIME_ONLY */
  63. time_t mkgmtime OF((struct tm *tm));
  64. #endif