--- YodaProfiler/src/GLTables.cpp 2006/09/05 10:48:58 1.3 +++ YodaProfiler/src/GLTables.cpp 2006/09/06 11:04:39 1.5 @@ -537,8 +537,13 @@ myquery << ",VALIDATION"; myquery << " from GL_RUN where ID=" << run << ";"; // + // printf(" myquery is %s \n",myquery.str().c_str()); pResult = dbc->Query(myquery.str().c_str()); - if(!pResult->GetRowCount())return(-50); + // + // printf(" getrowcount %i \n",pResult->GetRowCount()); + // + if( !pResult->GetRowCount() ) return(-50); + // for( r=0; r < 1000; r++){ Row = pResult->Next(); if( Row == NULL ) break; @@ -573,14 +578,10 @@ if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); - - }; }; - delete pResult; - - return 0; - + // delete pResult; + return(0); }; /** @@ -836,7 +837,7 @@ // ---------------- myquery.str(""); myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time; - myquery << " AND VALIDATION = 1 ORDER BY FROM_TIME DESC LIMIT 1;"; + myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; // myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; pResult = dbc->Query(myquery.str().c_str()); if(!pResult->GetRowCount())return (-55);//throw -55; @@ -1049,3 +1050,51 @@ return(pkt_num); // }; + +/* + * + * Convert the time in the DB from UInt_t to a string + * + * @param dbt time in the DB + * @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK + * + */ +TString GL_TIMESYNC::ConvertTime(TString tzone, UInt_t dbt){ + // + TDatime *time = new TDatime(); + TString rtime; + // + time->Set(dbt,false); // MSK = Moscow Winter Time + // + if ( !strcmp(tzone.Data(),"UTC") || !strcmp(tzone.Data(),"GMT") ){ + // + UInt_t timeUTC = time->Convert() - 60*60*3; // UTC (Coordinated Universal Time) = Moscow Winter Time - 3 hs + time->Set(timeUTC,false); + // + }; + // + if ( !strcmp(tzone.Data(),"CET") ){ + // + UInt_t timeCET = time->Convert() - 60*60*2; // CET (Central European Time) = Moscow Winter Time - 2 hs + time->Set(timeCET,false); + // + }; + // + if ( !strcmp(tzone.Data(),"CEST") ){ + // + UInt_t timeCEST = time->Convert() - 60*60*1; // CEST (Central European Summer Time) = Moscow Winter Time - 1 h + time->Set(timeCEST,false); + // + }; + // + if ( !strcmp(tzone.Data(),"MSD") ){ + // + UInt_t timeMSD = time->Convert() + 60*60*1; // MSD (Moscow Summer Time) = Moscow Winter Time + 1 h + time->Set(timeMSD,false); + // + }; + // + rtime = time->AsSQLString(); + // + return(rtime); +}