9 |
// ROOT headers |
// ROOT headers |
10 |
// |
// |
11 |
#include <TString.h> |
#include <TString.h> |
12 |
|
#include <TTimeStamp.h> |
13 |
#include <TSQLServer.h> |
#include <TSQLServer.h> |
14 |
#include <TFile.h> |
#include <TFile.h> |
15 |
#include <TSystem.h> |
#include <TSystem.h> |
240 |
exit(-1); |
exit(-1); |
241 |
}; |
}; |
242 |
// |
// |
243 |
|
myquery.str(""); |
244 |
|
myquery << "SET time_zone='+0:00'"; |
245 |
|
dbc->Query(myquery.str().c_str()); |
246 |
|
// |
247 |
GL_ROOT *glroot = new GL_ROOT(); |
GL_ROOT *glroot = new GL_ROOT(); |
248 |
GL_RUN *glrun = new GL_RUN(); |
GL_RUN *glrun = new GL_RUN(); |
249 |
GL_TIMESYNC *dbtime = new GL_TIMESYNC(); |
GL_TIMESYNC *dbtime = new GL_TIMESYNC(); |
285 |
// |
// |
286 |
if ( ruti ){ |
if ( ruti ){ |
287 |
// |
// |
288 |
TDatime *time = new TDatime(runtime.Data()); |
TDatime ti = TDatime(runtime.Data()); |
289 |
UInt_t dbti = time->Convert(); |
// |
290 |
|
TTimeStamp *time = new TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
291 |
|
// |
292 |
|
UInt_t dbti = time->GetSec(); |
293 |
// |
// |
294 |
TString thetime = dbtime->UnConvertTime(tzone,dbti); |
TString thetime = dbtime->UnConvertTime(tzone,dbti); |
295 |
// |
// |
296 |
TDatime *time2 = new TDatime(thetime.Data()); |
ti = TDatime(thetime.Data()); |
297 |
UInt_t mytime = time2->Convert(); |
TTimeStamp *time2 = new TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
298 |
|
// |
299 |
|
UInt_t mytime = time2->GetSec(); |
300 |
|
// |
301 |
Bool_t found = false; |
Bool_t found = false; |
302 |
// |
// |
303 |
myquery.str(""); |
myquery.str(""); |
337 |
// |
// |
338 |
if ( dtle ){ |
if ( dtle ){ |
339 |
// |
// |
340 |
TDatime *time = new TDatime(tletime.Data()); |
// |
341 |
UInt_t dbti = time->Convert(); |
TDatime ti = TDatime(runtime.Data()); |
342 |
|
// |
343 |
|
TTimeStamp *time = new TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
344 |
|
// |
345 |
|
UInt_t dbti = time->GetSec(); |
346 |
// |
// |
347 |
TString thetime = dbtime->UnConvertTime(tzone,dbti); |
TString thetime = dbtime->UnConvertTime(tzone,dbti); |
348 |
// |
// |
349 |
TDatime *time2 = new TDatime(thetime.Data()); |
ti = TDatime(thetime.Data()); |
350 |
UInt_t mytime = time2->Convert(); |
TTimeStamp *time2 = new TTimeStamp((UInt_t)ti.GetYear(),(UInt_t)ti.GetMonth(),(UInt_t)ti.GetDay(),(UInt_t)ti.GetHour(),(UInt_t)ti.GetMinute(),(UInt_t)ti.GetSecond(),0,true,0); |
351 |
|
// |
352 |
|
UInt_t mytime = time2->GetSec(); |
353 |
// |
// |
354 |
myquery.str(""); |
myquery.str(""); |
355 |
myquery << " select ID,TLE1,TLE2,TLE3 from GL_TLE where FROM_TIME<='" << time2->AsSQLString() << "' ORDER BY FROM_TIME DESC LIMIT 1;"; |
myquery << " select ID,TLE1,TLE2,TLE3 from GL_TLE where FROM_TIME<='" << time2->AsString("s") << "' ORDER BY FROM_TIME DESC LIMIT 1;"; |
356 |
// myquery << " from GL_TLE where FROM_TIME>=" << mytime << " ORDER BY FROM_TIME ASC LIMIT 1;"; |
// myquery << " from GL_TLE where FROM_TIME>=" << mytime << " ORDER BY FROM_TIME ASC LIMIT 1;"; |
357 |
// printf("myquery is %s \n",myquery.str().c_str()); |
// printf("myquery is %s \n",myquery.str().c_str()); |
358 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
491 |
found = true; |
found = true; |
492 |
if ( !r ) printf("\n File %s contains the following runs: \n\n",filename.Data()); |
if ( !r ) printf("\n File %s contains the following runs: \n\n",filename.Data()); |
493 |
TString UTC="UTC"; |
TString UTC="UTC"; |
494 |
printf(" => ID = %i _-_-_ the run started at %s UTC ended at %s UTC \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data()); |
printf(" => ID = %i --> the run started at %s UTC ended at %s UTC \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data()); |
495 |
}; |
}; |
496 |
delete pResult; |
delete pResult; |
497 |
myquery.str(""); |
myquery.str(""); |
504 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
505 |
if ( !r ) printf("\n File %s contains the following DELETED runs: \n\n",filename.Data()); |
if ( !r ) printf("\n File %s contains the following DELETED runs: \n\n",filename.Data()); |
506 |
TString UTC="UTC"; |
TString UTC="UTC"; |
507 |
printf(" => ID = %i _-_-_ the run started at %s UTC ended at %s UTC \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data()); |
printf(" => ID = %i --> the run started at %s UTC ended at %s UTC \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data()); |
508 |
}; |
}; |
509 |
// |
// |
510 |
if ( !found ){ |
if ( !found ){ |