Re: time_t timezone

From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-03 09:21:25
Message-ID: 41383795.1030702@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin pgsql-patches

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/

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Jaime Casanova 2004-09-03 23:01:55 Developers page is down
Previous Message Bruce Momjian 2004-09-02 14:04:07 Re: time_t timezone

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2004-09-03 15:05:38 Re: pgxs default installation + various fixes
Previous Message Fabien COELHO 2004-09-03 08:58:19 pgxs default installation + various fixes - v2