837 |
// ---------------- |
// ---------------- |
838 |
myquery.str(""); |
myquery.str(""); |
839 |
myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time; |
myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time; |
840 |
myquery << " AND VALIDATION = 1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
841 |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
842 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
843 |
if(!pResult->GetRowCount())return (-55);//throw -55; |
if(!pResult->GetRowCount())return (-55);//throw -55; |
1050 |
return(pkt_num); |
return(pkt_num); |
1051 |
// |
// |
1052 |
}; |
}; |
1053 |
|
|
1054 |
|
/* |
1055 |
|
* |
1056 |
|
* Convert the time in the DB from UInt_t to a string |
1057 |
|
* |
1058 |
|
* @param dbt time in the DB |
1059 |
|
* @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK |
1060 |
|
* |
1061 |
|
*/ |
1062 |
|
TString GL_TIMESYNC::ConvertTime(TString tzone, UInt_t dbt){ |
1063 |
|
// |
1064 |
|
TDatime *time = new TDatime(); |
1065 |
|
TString rtime; |
1066 |
|
// |
1067 |
|
time->Set(dbt,false); // MSK = Moscow Winter Time |
1068 |
|
// |
1069 |
|
if ( !strcmp(tzone.Data(),"UTC") || !strcmp(tzone.Data(),"GMT") ){ |
1070 |
|
// |
1071 |
|
UInt_t timeUTC = time->Convert() - 60*60*3; // UTC (Coordinated Universal Time) = Moscow Winter Time - 3 hs |
1072 |
|
time->Set(timeUTC,false); |
1073 |
|
// |
1074 |
|
}; |
1075 |
|
// |
1076 |
|
if ( !strcmp(tzone.Data(),"CET") ){ |
1077 |
|
// |
1078 |
|
UInt_t timeCET = time->Convert() - 60*60*2; // CET (Central European Time) = Moscow Winter Time - 2 hs |
1079 |
|
time->Set(timeCET,false); |
1080 |
|
// |
1081 |
|
}; |
1082 |
|
// |
1083 |
|
if ( !strcmp(tzone.Data(),"CEST") ){ |
1084 |
|
// |
1085 |
|
UInt_t timeCEST = time->Convert() - 60*60*1; // CEST (Central European Summer Time) = Moscow Winter Time - 1 h |
1086 |
|
time->Set(timeCEST,false); |
1087 |
|
// |
1088 |
|
}; |
1089 |
|
// |
1090 |
|
if ( !strcmp(tzone.Data(),"MSD") ){ |
1091 |
|
// |
1092 |
|
UInt_t timeMSD = time->Convert() + 60*60*1; // MSD (Moscow Summer Time) = Moscow Winter Time + 1 h |
1093 |
|
time->Set(timeMSD,false); |
1094 |
|
// |
1095 |
|
}; |
1096 |
|
// |
1097 |
|
rtime = time->AsSQLString(); |
1098 |
|
// |
1099 |
|
return(rtime); |
1100 |
|
} |