Re: 7.4.2 Regression tests: test stats loops indefinately... - Mailing list pgsql-general

From Manfred Koizar
Subject Re: 7.4.2 Regression tests: test stats loops indefinately...
Date
Msg-id 6hef90ps2e7im6dnl6qk0ba4g0ol0pr100@email.aon.at
Whole thread Raw
In response to Re: 7.4.2 Regression tests: test stats loops indefinately...  (Vikram Kulkarni <vkulkarn@brownforces.org>)
Responses Re: 7.4.2 Regression tests: test stats loops indefinately...
List pgsql-general
On Tue, 4 May 2004 10:51:30 -0400, Vikram Kulkarni <vkulkarn@brownforces.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

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: interval output format available that removes ambiguity ?
Next
From: "Karl O. Pinc"
Date:
Subject: FYI, foxpro to postgresql conversion scripts