Re: time_t timezone

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-08 19:40:28
Message-ID: 200409081940.i88JeS514536@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin pgsql-patches


OK, I have applied the following patch to fix the Cygwin _timezone
issue. I moved the TIMEZONE_GLOBAL up into port.h and change pgtz.c to
use that instead. I also changed the configure test for INT_TIMEZONE to
test for _timezone on Cygwin. This should fix all those problems.

You found a few problems in dirmod.c but have run out of time and will
deal with them in a few days.

---------------------------------------------------------------------------

Reini Urban wrote:
> Bruce Momjian schrieb:
>
> > Reini Urban wrote:
> >
> >>> # PGAC_VAR_INT_TIMEZONE
> >>> # ---------------------
> >>> # Check if the global variable `timezone' exists. If so, define
> >>> # HAVE_INT_TIMEZONE.
> >>> AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
> >>> [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
> >>> [AC_TRY_LINK([#include <time.h>
> >>> int res;],
> >>> [res = timezone / 60;],
> >>> [pgac_cv_var_int_timezone=yes],
> >>> [pgac_cv_var_int_timezone=no])])
> >>> if test x"$pgac_cv_var_int_timezone" = xyes ; then
> >>> AC_DEFINE(HAVE_INT_TIMEZONE,, [Define to 1 if you have the global
> >>> variable 'int timezone'.])
> >>> fi])# PGAC_VAR_INT_TIMEZONE
> >>>
> >>>You can look in include/pg_config.h to see how it is defined.
> >>
> >>This test fails, because you cannot do arithmetic with time_t.
> >>cygwin has/had a special workaround in pg_config_manual.h
> >>See Tom above.
>
> sorry, my mistake. you can do arithmetic with time_t.
>
> >>All other platforms with time_t timezone should manually enable their
> >>HAVE_INT_TIMEZONE and manually add the (int) timezone in
> >>src/timezone/pgtz.c.
> >
> > OK, let's get some facts. How is your timezone variable defined in your
> > headers? Is it _timezone? How is time_t defined? If you take the
> > program above and compile it alone, how does it fail?
>
> yes, it's only _timezone.
>
> already sent to this list. here it is:
>
> /usr/include/time.h from newlib.
> ...
> /* defines for the opengroup specifications Derived from Issue 1 of the
> SVID. */
> extern __IMPORT time_t _timezone;
> extern __IMPORT int _daylight;
> extern __IMPORT char *_tzname[2];
>
> which resolves to (gcc -E):
> # 98 "/usr/include/time.h" 3 4
> extern __attribute__((dllimport)) time_t _timezone;
> extern __attribute__((dllimport)) int _daylight;
> extern __attribute__((dllimport)) char *_tzname[2];
>
> time_t is a typedef from sys/types.h:
> #ifndef __time_t_defined
> typedef _TIME_T_ time_t;
> #define __time_t_defined
>
> _TIME_T_ is a macro from machine/types.h:
> define _TIME_T_ long
>
> > Also, look at your config.log output to see why it fails or email it to
> > my privately.
> ...
> configure:12843: checking for int timezone
> configure:12865: gcc -o conftest.exe -O2 -fno-strict-aliasing -Wall
> -Wmissing-prototypes -Wmissing-declarations -fno-strict-aliasing
> -L/usr/local/lib conftest.c -lssl -lcrypto -lz -lreadline -lcrypt
> -lresolv -lm >&5
> conftest.c: In function `main':
> conftest.c:67: error: invalid operands to binary /
> configure:12871: $? = 1
> configure: failed program was:
> ...
>
> #include <time.h>
> int res;
> int
> main ()
> {
> res = timezone / 60;
> ;
> return 0;
> }
>
> so my patch and my whole point is wrong.
> just the underscore is needed for cygwin in pg_config_manual.h
> --
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 3.6 KB

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Bruce Momjian 2004-09-09 00:23:38 Re: time_t timezone
Previous Message harish pathak 2004-09-08 10:43:40 Need help Installing Postgresql7.3.4

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2004-09-08 20:31:48 heap_modifytuple
Previous Message Dave Page 2004-09-08 19:32:38 Re: Contrib modules on Win32