timezone.h 2.8 KB

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