Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4a73eb5

Browse files
committed
Minor adjustments to enable public-domain timezone library to be called
from our code.
1 parent d248a67 commit 4a73eb5

File tree

8 files changed

+58
-13
lines changed

8 files changed

+58
-13
lines changed

src/include/c.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $PostgreSQL: pgsql/src/include/c.h,v 1.160 2004/03/10 21:12:46 momjian Exp $
15+
* $PostgreSQL: pgsql/src/include/c.h,v 1.161 2004/04/30 04:14:05 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -310,12 +310,16 @@ typedef unsigned long int uint64;
310310
#endif
311311

312312
/* Global variable holding time zone information. */
313+
#ifdef USE_PGTZ
314+
#define TIMEZONE_GLOBAL pg_timezone
315+
#else
313316
#ifndef HAVE_UNDERSCORE_TIMEZONE
314317
#define TIMEZONE_GLOBAL timezone
315318
#else
316319
#define TIMEZONE_GLOBAL _timezone
317320
#define tzname _tzname /* should be in time.h? */
318321
#endif
322+
#endif
319323

320324
/* sig_atomic_t is required by ANSI C, but may be missing on old platforms */
321325
#ifndef HAVE_SIG_ATOMIC_T

src/include/port.h

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.25 2004/04/19 17:42:59 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.26 2004/04/30 04:14:05 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -177,3 +177,37 @@ extern int pqGethostbyname(const char *name,
177177
#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
178178
#define WTERMSIG(w) ((w) & 0x7f)
179179
#endif
180+
181+
/*
182+
* Internal timezone library
183+
*/
184+
#ifdef USE_PGTZ
185+
#ifndef FRONTEND
186+
#undef localtime
187+
#undef gmtime
188+
#undef asctime
189+
#undef ctime
190+
#undef difftime
191+
#undef mktime
192+
#undef tzset
193+
194+
#define localtime(timep) pg_localtime(timep)
195+
#define gmtime(timep) pg_gmtime(timep)
196+
#define asctime(timep) pg_asctime(timep)
197+
#define ctime(timep) pg_ctime(timep)
198+
#define difftime(t1,t2) pg_difftime(t1,t2)
199+
#define mktime(tm) pg_mktime(tm)
200+
#define tzset pg_tzset
201+
202+
203+
extern struct tm *pg_localtime(const time_t *);
204+
extern struct tm *gg_gmtime(const time_t *);
205+
extern char *pg_asctime(const struct tm *);
206+
extern char *pg_ctime(const time_t *);
207+
extern double pg_difftime(const time_t, const time_t);
208+
extern time_t pg_mktime(struct tm *);
209+
extern void pg_tzset(void);
210+
extern time_t pg_timezone;
211+
212+
#endif
213+
#endif

src/interfaces/ecpg/compatlib/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.16 2004/04/25 20:57:32 momjian Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/Makefile,v 1.17 2004/04/30 04:14:05 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -16,7 +16,8 @@ NAME= ecpg_compat
1616
SO_MAJOR_VERSION= 1
1717
SO_MINOR_VERSION= 1
1818

19-
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
19+
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) \
20+
-I$(top_srcdir)/src/include/utils $(CPPFLAGS)
2021
override CFLAGS += $(PTHREAD_CFLAGS)
2122
SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) \
2223
$(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)

src/interfaces/ecpg/ecpglib/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.16 2004/04/25 20:57:32 momjian Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.17 2004/04/30 04:14:05 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -16,7 +16,8 @@ NAME= ecpg
1616
SO_MAJOR_VERSION= 4
1717
SO_MINOR_VERSION= 2
1818

19-
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) $(CPPFLAGS)
19+
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include \
20+
-I$(libpq_srcdir) $(CPPFLAGS)
2021
override CFLAGS += $(PTHREAD_CFLAGS)
2122

2223
OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \

src/interfaces/ecpg/pgtypeslib/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.17 2004/04/23 18:15:54 momjian Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.18 2004/04/30 04:14:06 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -16,7 +16,10 @@ NAME= pgtypes
1616
SO_MAJOR_VERSION= 1
1717
SO_MINOR_VERSION= 2
1818

19-
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(top_srcdir)/src/include/utils -I$(libpq_srcdir) $(CPPFLAGS) $(PTHREAD_CFLAGS)
19+
override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include \
20+
-I$(top_srcdir)/src/include/utils -I$(libpq_srcdir) $(CPPFLAGS) \
21+
$(PTHREAD_CFLAGS) -DFRONTEND
22+
2023
SHLIB_LINK += -lm
2124

2225
OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \

src/interfaces/ecpg/preproc/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.102 2004/04/26 17:40:48 momjian Exp $
1+
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.103 2004/04/30 04:14:06 momjian Exp $
22

33
subdir = src/interfaces/ecpg/preproc
44
top_builddir = ../../../..
@@ -12,7 +12,8 @@ override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \
1212
-DMAJOR_VERSION=$(MAJOR_VERSION) \
1313
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
1414
-DINCLUDEDIR=\"$(includedir)\" \
15-
-DPKGINCLUDEDIR=\"$(pkgincludedir)\"
15+
-DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
16+
-DFRONTEND
1617

1718
ifeq ($(GCC), yes)
1819
override CFLAGS += -Wno-error

src/interfaces/ecpg/test/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.46 2004/04/25 20:57:32 momjian Exp $
1+
# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.47 2004/04/30 04:14:06 momjian Exp $
22

33
subdir = src/interfaces/ecpg/test
44
top_builddir = ../../../..
@@ -9,7 +9,8 @@ override CFLAGS += $(PTHREAD_CFLAGS)
99

1010
ECPG = ../preproc/ecpg -I$(srcdir)/../include
1111

12-
TESTS = test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100 test_init testdynalloc num_test dt_test test_informix
12+
TESTS = test1 test2 test3 test4 perftest dyntest dyntest2 test_notice \
13+
test_code100 test_init testdynalloc num_test dt_test test_informix
1314
ifeq ($(enable_thread_safety), yes)
1415
TESTS += test_thread test_thread_implicit
1516
endif

src/timezone/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
This is a PostgreSQL adapted version of the timezone library
22
from:
3-
ftp://elsie.nci.nih.gov/pub/tz*.tar.gz
43

4+
ftp://elsie.nci.nih.gov/pub/tz*.tar.gz
55

66
The interface is used when USE_PGTZ is defined at the top level. This
77
will cause the following functions to be redefined:

0 commit comments

Comments
 (0)