Re: time_t timezone

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Reini Urban <rurban(at)x-ray(dot)at>, pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 21:45:21
Message-ID: 200409012145.i81LjLO19100@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin pgsql-patches

Tom Lane wrote:
> Reini Urban <rurban(at)x-ray(dot)at> writes:
> > Yes, they are talking about the localtime return value,
> > but nevertheless the newlib folks refer to that. Their fault.
>
> > Should I discuss that with them?
>
> Probably. They have a gratuitous variation from the Single Unix Spec.
>
> >> But what may be more to the point is that AFAICS we make no assumption
> >> about the exact datatype of the timezone variable.
>
> > Bruce' patch only assumes time_t on CYGWIN and it is only for pgtypeslib
> > (src/interfaces/ecpg/pgtypeslib/dt.h). Not for src/timezone/pgtz.c
>
> Per my recent post in pghackers, I think that the datatype has nothing
> to do with it anyway. The real problem is the loss of this code that
> was in pg_config_manual.h in 7.4 and before:
>
> /*
> * Define this if your operating system has _timezone rather than timezone
> */
> #if defined(__CYGWIN__) || defined(WIN32)
> #define HAVE_INT_TIMEZONE /* has int _timezone */
> #define HAVE_UNDERSCORE_TIMEZONE 1
> #endif
>
> I'm inclined to just put it back, rather than adding a configure test
> that we never needed before.

OK, I backed out the int cast I had made for dt.h. I agree time_t
should cast to int naturally. I noticed that HAVE_INT_TIMEZONE is
already a configure test. Is that test not working on Cygwin? Seems it
is working on MinGW. The test is this:

# 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.

--
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

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Bruce Momjian 2004-09-02 00:30:29 Re: open item: tablespace handing in pg_dump/pg_restore
Previous Message Reini Urban 2004-09-01 21:10:18 Re: time_t timezone

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-09-02 00:55:35 Re: dbsize contrib
Previous Message Reini Urban 2004-09-01 21:10:18 Re: time_t timezone