Hello together,

i would like to add the following changes to the code so that postgres
doesn�t have any problems if we compile it on machines that have
gettimeofday with 1 ARG and therefore don�t need 'struct timezone xxx'
I�m working on a System where timezone is defined in another way.

1. nabstime.c
Datum
timeofday(PG_FUNCTION_ARGS)
{
...
#ifndef GETTIMEOFDAY_1ARG
	struct timezone tpz;
#endif
...
}

2.postgres.c
ResetUsage(void)
{
#ifndef GETTIMEOFDAY_1ARG
	struct timezone tz;
#endif

	getrusage(RUSAGE_SELF, &Save_r);
	gettimeofday(&Save_t, &tz);
	ResetBufferUsage();
/*	  ResetTupleCount(); */
}


void
ShowUsage(void)
{
...
#ifndef GETTIMEOFDAY_1ARG
	struct timezone tz;
#endif
...
}

3. postmaster.c
static int
ServerLoop(void)
{
...
#ifndef GETTIMEOFDAY_1ARG
	struct timezone tz;
#endif
...
}

4. vacuum.c
void
vac_init_rusage(VacRUsage *ru0)
{
#ifndef GETTIMEOFDAY_1ARG
	struct timezone tz;
#endif

	getrusage(RUSAGE_SELF, &ru0->ru);
	gettimeofday(&ru0->tv, &tz);
}


Thanks

Ulrich Neumann


Tue, 8 Jan 2002 10:42:00 +0200
Ulrich Neumann<u_neumann@gne.de>
GETTIMEOFDAY_1ARG change
> i would like to add the following changes to the code so that postgres
> doesnï¿½t have any problems if we compile it on machines that have
> gettimeofday with 1 ARG and therefore donï¿½t need 'struct timezone xxx'
> Iï¿½m working on a System where timezone is defined in another way.

What system? How is timezone defined for that system? Is it something
completely new and different, or a variant which we already handle in
other places but not for this case?

...
> 2.postgres.c
> ResetUsage(void)
> {
> #ifndef GETTIMEOFDAY_1ARG
>         struct timezone tz;
> #endif
> 
>         getrusage(RUSAGE_SELF, &Save_r);
>         gettimeofday(&Save_t, &tz);
...

So what "one argument" does gettimeofday() have? Where does "tz" come
from if it is not defined here? Does it become a global variable? Where
is it declared?

afaik the nabstime.c usage of gettimeofday() has been in the PostgreSQL
code for quite a while, so I'm suprised that this is a problem on the
new mystery platform ;)

                    - Thomas

Tue, 08 Jan 2002 15:00:11 +0000
Thomas Lockhart <lockhart@fourpalms.org>
Re: GETTIMEOFDAY_1ARG change
Thomas Lockhart <lockhart@fourpalms.org> writes:
> afaik the nabstime.c usage of gettimeofday() has been in the PostgreSQL
> code for quite a while, so I'm suprised that this is a problem on the
> new mystery platform ;)

I imagine he's merely unhappy about seeing "unused variable" warnings.

I'm unconvinced that's worth cleaning up, and certainly wouldn't hold
up 7.2 release for it ...

			regards, tom lane

Tue, 08 Jan 2002 12:19:32 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: GETTIMEOFDAY_1ARG change 