Thanks guys,

MySQL defines the field as a DATETIME , so the return type is time_t. As
far as I could find out, there is no helper funtion to convert this into
secs from 1 Jan 1970 , so I got around it by using the difftime() call
and subtracting the returned value from 1/1/1970. difftime() returns the
difference in seconds.

Not sure it is the most elegant way to do it but it works ...;-}


-----Original Message-----
From: Markus Hoenicka [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 18, 2008 5:38 PM
To: Ken Ramsay
Subject: [libdbi-users] UNIX Timestamp - DATE to UTC conversion

Ken Ramsay writes:
 >           time = dbi_result_get_uint(result,
 > "UNIX_TIMESTAMP(HIST_Timestamp)");

Without actually trying the code: one rough guess is that MySQL does not
return the timestamp as an uint value but as something longer. Did you
try using dbi_result_get_field_type() and
dbi_result_get_field_attrib() to find out which type is returned?


Markus Hoenicka
(Spam-protected email: replace the quadrupeds with "mhoenicka")

This email was sent to you by Thomson Reuters, the global news and information 
Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Thomson Reuters.

This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
libdbi-users mailing list

Reply via email to