Re: how can i get the binary format of timestamp?

From: "energumen(at)buaa(dot)edu(dot)cn" <energumen(at)buaa(dot)edu(dot)cn>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: how can i get the binary format of timestamp?
Date: 2006-04-19 06:58:21
Message-ID: 20060419065723.BE21437F70@mx2.buaa.edu.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,Tom!
Thanks for your answer.
To invoid missing something of the timestamp, i just copy the tm2timestamp func into my 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,&timestampField);
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(at)buaa(dot)edu(dot)cn" <energumen(at)buaa(dot)edu(dot)cn> writes:
>> timestamp is defined as int64 or float8, when it is defined as int64, it looks like timeval, first 32 bits for seconds,second 32 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
>.

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


       
          

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-04-19 09:02:42 Re: Question on win32 semaphore simulation
Previous Message Tom Lane 2006-04-19 05:20:08 Re: Question on win32 semaphore simulation