ecpg - timestamp - howto - Mailing list pgsql-novice

From tövis
Subject ecpg - timestamp - howto
Date
Msg-id 002c01c5d0e3$002fbf90$3401a8c0@mainxp
Whole thread Raw
List 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
 
 
 

pgsql-novice by date:

Previous
From: Cath Lawrence
Date:
Subject: Re: pg_hba.conf and ssl problem has me stumped
Next
From: "krishnaa sridharan"
Date:
Subject: psql command line