Re: time_t timezone

Поиск
Список
Период
Сортировка
От Reini Urban
Тема Re: time_t timezone
Дата
Msg-id 41383795.1030702@x-ray.at
обсуждение исходный текст
Ответ на Re: time_t timezone  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: time_t timezone  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список 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/

В списке pgsql-patches по дате отправления:

Предыдущее
От: Claudio Natoli
Дата:
Сообщение: Re: [pgsql-hackers-win32] [BUGS] Win32 deadlock detecti
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgxs default installation + various fixes