summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBruce Momjian2004-04-30 04:14:06 +0000
committerBruce Momjian2004-04-30 04:14:06 +0000
commit4a73eb5ab1552913b2831ec0bd978dccb95f7b5b (patch)
tree7e75a59a26a263012d47bc23010919b9e1bf830f /src/include
parentd248a67af1d849438e146bccd46adb1eb0a9f3b5 (diff)
Minor adjustments to enable public-domain timezone library to be called
from our code.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/c.h6
-rw-r--r--src/include/port.h36
2 files changed, 40 insertions, 2 deletions
diff --git a/src/include/c.h b/src/include/c.h
index 325cfc217d0..6d7f852ed5f 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/c.h,v 1.160 2004/03/10 21:12:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.161 2004/04/30 04:14:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -310,12 +310,16 @@ typedef unsigned long int uint64;
#endif
/* Global variable holding time zone information. */
+#ifdef USE_PGTZ
+#define TIMEZONE_GLOBAL pg_timezone
+#else
#ifndef HAVE_UNDERSCORE_TIMEZONE
#define TIMEZONE_GLOBAL timezone
#else
#define TIMEZONE_GLOBAL _timezone
#define tzname _tzname /* should be in time.h? */
#endif
+#endif
/* sig_atomic_t is required by ANSI C, but may be missing on old platforms */
#ifndef HAVE_SIG_ATOMIC_T
diff --git a/src/include/port.h b/src/include/port.h
index 93b549503fd..f6d37d3bed1 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/port.h,v 1.25 2004/04/19 17:42:59 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.26 2004/04/30 04:14:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,3 +177,37 @@ extern int pqGethostbyname(const char *name,
#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
#define WTERMSIG(w) ((w) & 0x7f)
#endif
+
+/*
+ * Internal timezone library
+ */
+#ifdef USE_PGTZ
+#ifndef FRONTEND
+#undef localtime
+#undef gmtime
+#undef asctime
+#undef ctime
+#undef difftime
+#undef mktime
+#undef tzset
+
+#define localtime(timep) pg_localtime(timep)
+#define gmtime(timep) pg_gmtime(timep)
+#define asctime(timep) pg_asctime(timep)
+#define ctime(timep) pg_ctime(timep)
+#define difftime(t1,t2) pg_difftime(t1,t2)
+#define mktime(tm) pg_mktime(tm)
+#define tzset pg_tzset
+
+
+extern struct tm *pg_localtime(const time_t *);
+extern struct tm *gg_gmtime(const time_t *);
+extern char *pg_asctime(const struct tm *);
+extern char *pg_ctime(const time_t *);
+extern double pg_difftime(const time_t, const time_t);
+extern time_t pg_mktime(struct tm *);
+extern void pg_tzset(void);
+extern time_t pg_timezone;
+
+#endif
+#endif