7 /* Sigh, RedHat 5 has the TM_ZONE stuff, but only when _BSD_SOURCE is
8 * on. The configure script erroneously says we've got TM_ZONE, so
9 * make sure we use the TZNAME stuff instead.
11 * Aside: tzname is POSIX, whereas tm_zone is BSD. We should be using
12 * tzname by preference, but the GNU configure stuff gives us HAVE_TM_ZONE
13 * in preference to HAVE_TZNAME. More sighs.
16 # define HAVE_TZNAME 1
19 #if TIME_WITH_SYS_TIME
20 # include <sys/time.h>
24 # include <sys/time.h>
31 #define ZONE(x) (((struct tm *)x)->tm_zone)
32 #define SETZONE(x,z) (((struct tm *)x)->tm_zone = z)
33 #define GMTOFF(x) (((struct tm *)x)->tm_gmtoff)
34 #else /* ! HAVE_TM_ZONE */
35 # if HAVE_TZNAME || cygwin32_TARGET_OS
36 #if cygwin32_TARGET_OS
39 extern char *tzname[2];
41 # define ZONE(x) (((struct tm *)x)->tm_isdst ? tzname[1] : tzname[0])
43 # else /* ! HAVE_TZNAME */
44 /* We're in trouble. If you should end up here, please report this as a bug. */
45 # error Dont know how to get at timezone name on your OS.
46 # endif /* ! HAVE_TZNAME */
47 /* Get the offset in secs from UTC, if (struct tm) doesn't supply it. */
49 extern TYPE_TIMEZONE timezone;
52 extern time_t altzone;
53 # define GMTOFF(x) (((struct tm *)x)->tm_isdst ? altzone : timezone)
54 # else /* ! HAVE_ALTZONE */
55 /* Assume that DST offset is 1 hour ... */
56 # define GMTOFF(x) (((struct tm *)x)->tm_isdst ? (timezone - 3600) : timezone)
57 # endif /* ! HAVE_ALTZONE */
58 #endif /* ! HAVE_TM_ZONE */
60 #endif /* TIMEZONE_H */