Re: 7.4.2 Regression tests: test stats loops indefinately...

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Vikram Kulkarni <vkulkarn(at)brownforces(dot)org>
Cc: Vikram Kulkarni <vkulkarn(at)brownforces(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: 7.4.2 Regression tests: test stats loops indefinately...
Date: 2004-05-04 17:42:02
Message-ID: 6hef90ps2e7im6dnl6qk0ba4g0ol0pr100@email.aon.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 4 May 2004 10:51:30 -0400, Vikram Kulkarni <vkulkarn(at)brownforces(dot)org> wrote:
>> Vik, I guess that on your platform time_t is smaller than long.

>hmmm... on OpenBSD-3.5/sparc64, time_t is an int...

... which is 32 bit, while long is 64 bit.

>But on my older, OpenBSD-3.1/i386 computer, time_t is defined in the
>same way

On i386 both int and long are 32 bit.

Ok, this is pretty clear now. Apply this patch and recompile Postgres.

diff -ruN ../base/src/backend/utils/adt/nabstime.c src/backend/utils/adt/nabstime.c
--- ../base/src/backend/utils/adt/nabstime.c 2003-09-29 02:05:25.000000000 +0200
+++ src/backend/utils/adt/nabstime.c 2004-05-04 18:05:14.000000000 +0200
@@ -1728,10 +1728,12 @@
char buf[100];
text *result;
int len;
+ time_t tt;

gettimeofday(&tp, &tpz);
+ tt = (time_t) tp.tv_sec;
strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z",
- localtime((time_t *) &tp.tv_sec));
+ localtime(&tt));
snprintf(buf, sizeof(buf), templ, tp.tv_usec);

len = VARHDRSZ + strlen(buf);

HTH.
Servus
Manfred

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2004-05-04 17:42:41 Re: interval output format available that removes ambiguity ?
Previous Message Kevin 2004-05-04 17:18:21 Embedded SQL inherently faster than others?