Good afternoon.
I’m using ROOT (ROOT 5.34.36) classes to work with our PostgreSQL database (8.4).
I write TDatime variable to the database and then immediately read it back via TSQLStatement::SetDatime/GetDatime functions. But it returns another date/time value, it’s different for 16 hours.
It’s concerned with wrong "void TPgSQLStatement::ConvertTimeToUTC(const TString &PQvalue, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec) " function.
It checks +/- UTC and finds the minus inside the date part, e.g. “2004-10-19 10:23:54” (compare with "“2004-10-19 10:23:54-02"”). Then it checks position of the minus relative ‘.’. But there is no any ‘.’
I propose to use ‘:’ symbol (using in the time part) - it works.
i.e.
instead of:
void TPgSQLStatement::ConvertTimeToUTC(const TString &PQvalue, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec)
{
// Convert timestamp value to UTC if a zone is included.
Ssiz_t p = PQvalue.Last('.');
use:
void TPgSQLStatement::ConvertTimeToUTC(const TString &PQvalue, Int_t& year, Int_t& month, Int_t& day, Int_t& hour, Int_t& min, Int_t& sec)
{
// Convert timestamp value to UTC if a zone is included.
Ssiz_t p = PQvalue.Last(':');
With respect, Konstantin.