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