Обсуждение: ecpg - timestamp - howto

Поиск
Список
Период
Сортировка

ecpg - timestamp - howto

От
tövis
Дата:
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