ecpg - timestamp - howto

From: tövis <tovises(at)freemail(dot)hu>
To: "pgsql novice" <pgsql-novice(at)postgresql(dot)org>
Subject: ecpg - timestamp - howto
Date: 2005-10-14 17:16:22
Message-ID: 002c01c5d0e3$002fbf90$3401a8c0@mainxp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi!
Has some one used timestamps through ecpg in a simple C program?
How to declare, an acceptor variable to convert timestamp (w/o timezone) to a simple time_t or timeval value?

I'm using PostgreSQL 7.4.7(-6sarge1) on Debian 3.1 stable, client is also a Debian 3.1 workstation.

I have tried include "pgtypes_timestamp.h"

exec sql BEGIN DECLARE SECTION;
...
timestamp TBL_dtm;
...
exec sql AND DECLARE SECTION;

int somefunc()
{
time_t stamp;
...
exec sql FETCH NEXT TBL_cursor
INTO :TBL_dtm ...

...
stamp = TBL_dtm;

}

All other values drawn by SELECT through cursor are good but timestamp to time_t gives ZERO (1970.01.01 01:00:00:00);o(
Of course I can write my own conversion routine for string of timestamp but I now it should be ready to use in ecpg libraries!

Thanks in advance
Tovis

Browse pgsql-novice by date

  From Date Subject
Next Message Scott Auge 2005-10-16 03:56:53 A warning!!! OS X Major Version Upgrade
Previous Message djzanky 2005-10-13 18:21:34 Problems with query using aggregate functions