45 |
printf("\n -runatDB time returns run number which contains the given DB time\n"); |
printf("\n -runatDB time returns run number which contains the given DB time\n"); |
46 |
printf("\n -tsfile file yoda filename for the time sync (to be used with -obt)\n"); |
printf("\n -tsfile file yoda filename for the time sync (to be used with -obt)\n"); |
47 |
printf("\n -obt OBT OBT in ms returns a date (to be used with -tsfile)\n"); |
printf("\n -obt OBT OBT in ms returns a date (to be used with -tsfile)\n"); |
48 |
|
printf("\n -getRTime OBT OBT in ms returns Resurs time (to be used with -tsfile)\n"); |
49 |
printf("\n -dumpTLEfor date save into file tle.txt the TLE for the given date,\n"); |
printf("\n -dumpTLEfor date save into file tle.txt the TLE for the given date,\n"); |
50 |
printf("\n for date use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
printf("\n for date use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
51 |
printf("\nExamples: \n"); |
printf("\nExamples: \n"); |
89 |
TString tletime = "1970-01-01 00:00:00"; |
TString tletime = "1970-01-01 00:00:00"; |
90 |
UInt_t dbti = 0; |
UInt_t dbti = 0; |
91 |
Bool_t convert = false; |
Bool_t convert = false; |
92 |
|
Bool_t convres = false; |
93 |
Bool_t ruti = false; |
Bool_t ruti = false; |
94 |
Bool_t dtle = false; |
Bool_t dtle = false; |
95 |
Bool_t ruti2 = false; |
Bool_t ruti2 = false; |
98 |
// |
// |
99 |
UInt_t runtime2 = 0; |
UInt_t runtime2 = 0; |
100 |
UInt_t obt = 0; |
UInt_t obt = 0; |
101 |
|
UInt_t res = 0; |
102 |
TString tsfile = ""; |
TString tsfile = ""; |
103 |
// |
// |
104 |
TSQLResult *pResult; |
TSQLResult *pResult; |
174 |
obt = (UInt_t)atoll(inps[i+1]); |
obt = (UInt_t)atoll(inps[i+1]); |
175 |
}; |
}; |
176 |
// |
// |
177 |
|
if ( !strcmp(inps[i],"-getRTime") ) { |
178 |
|
convres = true; |
179 |
|
if ( numinp-1 < i+1 ){ |
180 |
|
r2d2usage(); |
181 |
|
exit(-3); |
182 |
|
}; |
183 |
|
res = (UInt_t)atoll(inps[i+1]); |
184 |
|
}; |
185 |
|
// |
186 |
// |
// |
187 |
if ( !strcmp(inps[i],"-tzone") ) { |
if ( !strcmp(inps[i],"-tzone") ) { |
188 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
266 |
printf("\n DB time %u is %s %s \n",dbti,dbtime->ConvertTime(tzone,dbti).Data(),tzone.Data()); |
printf("\n DB time %u is %s %s \n",dbti,dbtime->ConvertTime(tzone,dbti).Data(),tzone.Data()); |
267 |
}; |
}; |
268 |
// |
// |
269 |
// |
// convert OBT to date |
270 |
// |
// |
271 |
if ( convobt && convobtts ){ |
if ( convobt && convobtts ){ |
272 |
UInt_t id = 0; |
UInt_t id = 0; |
282 |
delete pResult; |
delete pResult; |
283 |
GL_TIMESYNC *ctime = new GL_TIMESYNC(id,"ID",dbc); |
GL_TIMESYNC *ctime = new GL_TIMESYNC(id,"ID",dbc); |
284 |
UInt_t abtime = ctime->DBabsTime(obt); |
UInt_t abtime = ctime->DBabsTime(obt); |
|
TString UTC="UTC"; |
|
285 |
TString thetime = dbtime->ConvertTime(tzone,abtime); |
TString thetime = dbtime->ConvertTime(tzone,abtime); |
286 |
printf("\n OBT %u in the file %s corresponds to DBtime %u and date %s %s \n",obt,tsfile.Data(),abtime,thetime.Data(),tzone.Data()); |
printf("\n OBT %u in the file %s corresponds to DBtime %u and date %s %s \n",obt,tsfile.Data(),abtime,thetime.Data(),tzone.Data()); |
287 |
delete ctime; |
delete ctime; |
288 |
}; |
}; |
289 |
}; |
}; |
290 |
}; |
}; |
291 |
if ( (convobt && !convobtts) || (convobtts && !convobt) ){ |
if ( (convobt && !convobtts) ){ |
292 |
printf("\n To convert a OBT to a date you must provide both OBT and file to be used for time sync \n"); |
printf("\n To convert a OBT to a date you must provide both OBT and file to be used for time sync \n"); |
293 |
}; |
}; |
294 |
// |
// |
295 |
|
// convert OBT to Resurs seconds |
296 |
|
// |
297 |
|
if ( convres && convobtts ){ |
298 |
|
UInt_t id = 0; |
299 |
|
myquery.str(""); |
300 |
|
myquery << "select "; |
301 |
|
myquery << " ID"; |
302 |
|
myquery << " from GL_ROOT where NAME=\"" << tsfile.Data() << "\";"; |
303 |
|
pResult = dbc->Query(myquery.str().c_str()); |
304 |
|
if ( pResult ){ |
305 |
|
Row = pResult->Next(); |
306 |
|
if ( Row ){ |
307 |
|
id = (UInt_t)atoll(Row->GetField(0)); |
308 |
|
delete pResult; |
309 |
|
GL_TIMESYNC *ctime = new GL_TIMESYNC(id,"ID",dbc); |
310 |
|
UInt_t restime = ctime->ResursTime(res); |
311 |
|
//UInt_t abtime = ctime->DBabsTime(obt); |
312 |
|
// |
313 |
|
// TString thetime = dbtime->ConvertTime(tzone,abtime); |
314 |
|
printf("\n OBT %u in the file %s corresponds to Resurs time %u \n",res,tsfile.Data(),restime); |
315 |
|
delete ctime; |
316 |
|
}; |
317 |
|
}; |
318 |
|
}; |
319 |
|
if ( (convres && !convobtts) ){ |
320 |
|
printf("\n To convert a OBT to the Resurs time you must provide both OBT and file to be used for time sync \n"); |
321 |
|
}; |
322 |
|
// |
323 |
// Which run contains the date "runtime"? |
// Which run contains the date "runtime"? |
324 |
// |
// |
325 |
if ( ruti ){ |
if ( ruti ){ |