summaryrefslogtreecommitdiff
path: root/ghc/lib/std/cbits/timezone.h
diff options
context:
space:
mode:
authorsimonm <unknown>1998-02-02 17:35:59 +0000
committersimonm <unknown>1998-02-02 17:35:59 +0000
commit28139aea50376444d56f43f0914291348a51a7e7 (patch)
tree595c378188638ef16462972c1e7fcdb8409c7f16 /ghc/lib/std/cbits/timezone.h
parent98a1ebecb6d22d793b1d9f8e1d24ecbb5a2d130f (diff)
downloadhaskell-28139aea50376444d56f43f0914291348a51a7e7.tar.gz
[project @ 1998-02-02 17:27:26 by simonm]
Library re-organisation: All libraries now live under ghc/lib, which has the following structure: ghc/lib/std -- all prelude files (libHS.a) ghc/lib/std/cbits ghc/lib/exts -- standard Hugs/GHC extensions (libHSexts.a) -- available with '-fglasgow-exts' ghc/lib/posix -- POSIX library (libHSposix.a) ghc/lib/posix/cbits -- available with '-syslib posix' ghc/lib/misc -- used to be hslibs/ghc (libHSmisc.a) ghc/lib/misc/cbits -- available with '-syslib misc' ghc/lib/concurrent -- Concurrent libraries (libHSconc.a) -- available with '-concurrent' Also, several non-standard prelude modules had their names changed to begin with 'Prel' to reduce namespace pollution. Addr ==> PrelAddr (Addr interface available in 'exts') ArrBase ==> PrelArr CCall ==> PrelCCall (CCall interface available in 'exts') ConcBase ==> PrelConc GHCerr ==> PrelErr Foreign ==> PrelForeign (Foreign interface available in 'exts') GHC ==> PrelGHC IOHandle ==> PrelHandle IOBase ==> PrelIOBase GHCmain ==> PrelMain STBase ==> PrelST Unsafe ==> PrelUnsafe UnsafeST ==> PrelUnsafeST
Diffstat (limited to 'ghc/lib/std/cbits/timezone.h')
-rw-r--r--ghc/lib/std/cbits/timezone.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/ghc/lib/std/cbits/timezone.h b/ghc/lib/std/cbits/timezone.h
new file mode 100644
index 0000000000..46b907f269
--- /dev/null
+++ b/ghc/lib/std/cbits/timezone.h
@@ -0,0 +1,47 @@
+#ifndef TIMEZONE_H
+#define TIMEZONE_H
+
+#define _OSF_SOURCE
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_TM_ZONE
+#define ZONE(x) (((struct tm *)x)->tm_zone)
+#define SETZONE(x,z) (((struct tm *)x)->tm_zone = z)
+#define GMTOFF(x) (((struct tm *)x)->tm_gmtoff)
+#else /* ! HAVE_TM_ZONE */
+# if HAVE_TZNAME || cygwin32_TARGET_OS
+#if cygwin32_TARGET_OS
+extern char *tzname;
+#else
+extern char *tzname[2];
+#endif
+# define ZONE(x) (((struct tm *)x)->tm_isdst ? tzname[1] : tzname[0])
+# define SETZONE(x,z)
+# else /* ! HAVE_TZNAME */
+/* We're in trouble. If you should end up here, please report this as a bug. */
+# error Dont know how to get at timezone name on your OS.
+# endif /* ! HAVE_TZNAME */
+/* Get the offset in secs from UTC, if (struct tm) doesn't supply it. */
+
+extern TYPE_TIMEZONE timezone;
+
+# if HAVE_ALTZONE
+extern time_t altzone;
+# define GMTOFF(x) (((struct tm *)x)->tm_isdst ? altzone : timezone)
+# else /* ! HAVE_ALTZONE */
+/* Assume that DST offset is 1 hour ... */
+# define GMTOFF(x) (((struct tm *)x)->tm_isdst ? (timezone - 3600) : timezone)
+# endif /* ! HAVE_ALTZONE */
+#endif /* ! HAVE_TM_ZONE */
+
+#endif /* TIMEZONE_H */