Re: how can i get the binary format of timestamp? - Mailing list pgsql-hackers

From energumen@buaa.edu.cn
Subject Re: how can i get the binary format of timestamp?
Date
Msg-id 20060419065723.BE21437F70@mx2.buaa.edu.cn
Whole thread Raw
In response to how can i get the binary format of timestamp?  ("energumen@buaa.edu.cn" <energumen@buaa.edu.cn>)
Responses Re: how can i get the binary format of timestamp?
List pgsql-hackers
Hello,Tom!  Thanks for your answer.  To invoid missing something of the timestamp, i just copy the tm2timestamp func
intomy program.(Of course, some other related functions are copied, too), result is still refusing me.
 

What i need is: 41A7 7DBA D400 0000 stands for "2006-03-30 18:18:18" ( 41A7 7DBA D400 0000 is got from the Copy to
File)
When using tm2timestamp, result is:
if define HAVE_INT64_TIMESTAMP
result is:  4E66 E642 0030 C274
if not define HAVE_INT64_TIMESTAMP
{ if define INT64_IS_BUSTED result is: 6972 2142 0000 00DB if not define INT64_IS_BUSTED result is: 4221 7269 DB00
0000
}

So, maybe  I forget to define something??

/******************************************************************************************************
* my codes 
*
*/
my program is listed:
time_t time = 1143713898;
struct tm* tmField = gmtime(&time);    // I know that struct tm dislikes the struct tm in "time.h"
tmField->tm_year += 1900;
tmField->tm_mon += 1;                  // So tmFiled is same as pg_tm
int tzp = 8;
char buffer[256];

timestamp timestampField ;
tm2timestamp(tmField,0,&tzp,×tampField);
timestamp_send(timestampField,buffer);   // I changed some codes here, to get the binary format of timestamp 

/*********************************************************************************************************/    

so ,what switch should i turn on?

======= 2006-04-18 21:47:42 You Wrote:=======

>"energumen@buaa.edu.cn" <energumen@buaa.edu.cn> writes:
>> timestamp is defined as int64 or float8, when it is defined as int64, it looks like timeval, first 32 bits for
seconds,second32 bits for usec.
 
>
>No, it's seconds times 1000000, not times 2^32.
>
>            regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faq
>.

= = = = = = = = = = = = = = = = = = = =             
       
          


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Question on win32 semaphore simulation
Next
From: "Magnus Hagander"
Date:
Subject: Re: Question on win32 semaphore simulation