58 |
VALIDATION = 0; |
VALIDATION = 0; |
59 |
} |
} |
60 |
|
|
61 |
|
|
62 |
void GL_RUN::Clear() { |
void GL_RUN::Clear() { |
63 |
ID = 0; |
ID = 0; |
64 |
ID_RUN_FRAG = 0; |
ID_RUN_FRAG = 0; |
123 |
OBT2 = 0; |
OBT2 = 0; |
124 |
PKT1 = 0; |
PKT1 = 0; |
125 |
PKT2 = 0; |
PKT2 = 0; |
126 |
|
BOOT_NUMBER = 0; |
127 |
|
VALIDATION = 0; |
128 |
} |
} |
129 |
|
|
130 |
GL_CALO_CALIB::GL_CALO_CALIB(){ |
GL_CALO_CALIB::GL_CALO_CALIB(){ |
330 |
CAL_DSP_MASK = 0; |
CAL_DSP_MASK = 0; |
331 |
}; |
}; |
332 |
|
|
333 |
|
void GL_RUN::Set_GL_RUN(TSQLRow *Row){ |
334 |
|
for( Int_t t = 0; t < 30; t++){ |
335 |
|
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
336 |
|
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
337 |
|
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
338 |
|
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
339 |
|
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
340 |
|
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
341 |
|
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
342 |
|
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
343 |
|
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
344 |
|
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
345 |
|
if (t==10) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
346 |
|
if (t==11) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
347 |
|
if (t==12) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
348 |
|
if (t==13) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
349 |
|
if (t==14) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
350 |
|
if (t==15) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
351 |
|
if (t==16) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
352 |
|
if (t==17) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
353 |
|
if (t==18) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
354 |
|
if (t==19) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
355 |
|
if (t==20) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
356 |
|
if (t==21) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
357 |
|
if (t==22) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
358 |
|
if (t==23) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
359 |
|
if (t==24) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
360 |
|
if (t==25) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
361 |
|
if (t==26) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
362 |
|
if (t==27) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
363 |
|
if (t==28) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
364 |
|
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
365 |
|
}; |
366 |
|
|
367 |
|
} |
368 |
|
|
369 |
|
|
370 |
/** |
/** |
371 |
* Function to fill the GL_RUN table of the DB. |
* Function to fill the GL_RUN table of the DB. |
576 |
myquery << ",VALIDATION"; |
myquery << ",VALIDATION"; |
577 |
myquery << " from GL_RUN where ID=" << run << ";"; |
myquery << " from GL_RUN where ID=" << run << ";"; |
578 |
// |
// |
579 |
|
// printf(" myquery is %s \n",myquery.str().c_str()); |
580 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
581 |
if(!pResult->GetRowCount())return(-50); |
// |
582 |
|
// printf(" getrowcount %i \n",pResult->GetRowCount()); |
583 |
|
// |
584 |
|
if( !pResult->GetRowCount() ) return(-50); |
585 |
|
// |
586 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
587 |
Row = pResult->Next(); |
Row = pResult->Next(); |
588 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
589 |
|
// Set_GL_RUN(Row); |
590 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
591 |
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
592 |
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
593 |
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
594 |
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
595 |
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
596 |
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
597 |
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
598 |
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
599 |
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
600 |
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
601 |
if (t==10) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
if (t==10) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
602 |
if (t==11) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
if (t==11) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
603 |
if (t==12) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
if (t==12) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
604 |
if (t==13) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
if (t==13) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
605 |
if (t==14) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
if (t==14) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
606 |
if (t==15) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
if (t==15) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
607 |
if (t==16) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
if (t==16) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
608 |
if (t==17) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
if (t==17) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
609 |
if (t==18) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
if (t==18) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
610 |
if (t==19) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
if (t==19) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
611 |
if (t==20) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
if (t==20) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
612 |
if (t==21) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
if (t==21) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
613 |
if (t==22) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
if (t==22) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
614 |
if (t==23) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
if (t==23) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
615 |
if (t==24) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
if (t==24) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
616 |
if (t==25) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
if (t==25) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
617 |
if (t==26) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
if (t==26) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
618 |
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
619 |
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
620 |
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
|
|
|
|
|
|
621 |
}; |
}; |
622 |
}; |
}; |
623 |
delete pResult; |
// delete pResult; |
624 |
|
return(0); |
|
return 0; |
|
|
|
|
625 |
}; |
}; |
626 |
|
|
627 |
/** |
/** |
761 |
* Function to query the GL_TRK_CALIB table of the DB. |
* Function to query the GL_TRK_CALIB table of the DB. |
762 |
* |
* |
763 |
* \param run starting time |
* \param run starting time |
764 |
|
* \param dbc DB server |
765 |
* \return struct of type GL_TRK_CALIB_data, which stores the query result |
* \return struct of type GL_TRK_CALIB_data, which stores the query result |
766 |
*/ |
*/ |
767 |
Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(UInt_t time, TSQLServer *dbc){ |
Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(UInt_t time, TSQLServer *dbc){ |
773 |
stringstream myquery; |
stringstream myquery; |
774 |
// ---------------- |
// ---------------- |
775 |
myquery.str(""); |
myquery.str(""); |
776 |
myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2 from GL_TRK_CALIB where FROM_TIME <= "<< time; |
myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2,BOOT_NUMBER,VALIDATION from GL_TRK_CALIB where FROM_TIME <= "<< time; |
777 |
myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
778 |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
779 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
785 |
stringstream row; |
stringstream row; |
786 |
row.str(""); |
row.str(""); |
787 |
row << "0" << Row->GetField(t); // add leading 0 since we have two fields that could be "null" and we want to avoid crashes due to atoll |
row << "0" << Row->GetField(t); // add leading 0 since we have two fields that could be "null" and we want to avoid crashes due to atoll |
788 |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
789 |
if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
790 |
if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(row.str().c_str()); |
if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(row.str().c_str()); |
791 |
if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(row.str().c_str()); |
if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(row.str().c_str()); |
792 |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
793 |
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
794 |
// |
// |
795 |
if (t==6) OBT1 = (UInt_t)atoll(Row->GetField(t)); |
if (t==6) OBT1 = (UInt_t)atoll(Row->GetField(t)); |
796 |
if (t==7) OBT2 = (UInt_t)atoll(Row->GetField(t)); |
if (t==7) OBT2 = (UInt_t)atoll(Row->GetField(t)); |
797 |
if (t==8) PKT1 = (UInt_t)atoll(Row->GetField(t)); |
if (t==8) PKT1 = (UInt_t)atoll(Row->GetField(t)); |
798 |
if (t==9) PKT2 = (UInt_t)atoll(Row->GetField(t)); |
if (t==9) PKT2 = (UInt_t)atoll(Row->GetField(t)); |
799 |
}; |
if (t==10) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
800 |
|
if (t==11) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
801 |
|
}; |
802 |
}; |
}; |
803 |
delete pResult; |
delete pResult; |
804 |
|
// |
805 |
|
// if ( TO_TIME < time ) return(51); |
806 |
// |
// |
|
if(TO_TIME < time)return(51); |
|
807 |
if ( (!OBT1 && !PKT1 ) || (!OBT2 && !PKT2) ) return(52); // ONE CALIBRATION PACKET IS MISSING! |
if ( (!OBT1 && !PKT1 ) || (!OBT2 && !PKT2) ) return(52); // ONE CALIBRATION PACKET IS MISSING! |
808 |
// |
// |
809 |
return 0; |
return 0; |
816 |
* \param run starting time |
* \param run starting time |
817 |
* \return struct of type GL_CALO_CALIB_data, which stores the query result |
* \return struct of type GL_CALO_CALIB_data, which stores the query result |
818 |
*/ |
*/ |
819 |
Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB(UInt_t time, UInt_t section, TSQLServer *dbc){ |
Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB(UInt_t time, UInt_t &uptime, UInt_t section, TSQLServer *dbc){ |
820 |
// MySQL variables |
// MySQL variables |
821 |
TSQLResult *pResult; |
TSQLResult *pResult; |
822 |
TSQLRow *Row; |
TSQLRow *Row; |
823 |
int t; |
int t; |
824 |
stringstream myquery; |
stringstream myquery; |
825 |
|
uptime = 0; |
826 |
// |
// |
827 |
// select the correct calibration |
// select the correct calibration |
828 |
// |
// |
830 |
myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT,VALIDATION from GL_CALO_CALIB where SECTION=" << section; |
myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT,VALIDATION from GL_CALO_CALIB where SECTION=" << section; |
831 |
myquery << " and FROM_TIME <= " << time; |
myquery << " and FROM_TIME <= " << time; |
832 |
myquery << " and TO_TIME > " << time; |
myquery << " and TO_TIME > " << time; |
833 |
myquery << " and VALIDATION=1;"; |
myquery << " ;"; |
834 |
|
//myquery << " and VALIDATION=1;"; |
835 |
// |
// |
836 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
837 |
|
// printf(" mysquery is %s\n",myquery.str().c_str()); |
838 |
|
// |
839 |
|
if( !pResult->GetRowCount() ) return(-54); |
840 |
|
Row = pResult->Next(); |
841 |
|
if( Row == NULL ) return (-54); |
842 |
|
// |
843 |
|
uptime = (UInt_t)atoll(Row->GetField(2)); |
844 |
// |
// |
845 |
// if it is corrupted validation is 0 and we have no results from the query... |
// if it is corrupted validation is 0 and we have no results from the query... |
846 |
// |
// |
847 |
if( !pResult->GetRowCount() ){ |
if( atoi(Row->GetField(4)) == 0 ){ // if validation = 0 |
|
// pResult->Delete(); |
|
848 |
// |
// |
849 |
// in this case take relax the conditions and take the valid calibration that preceed the correct one |
// in this case take relax the conditions and take the valid calibration that preceed the correct one |
850 |
// |
// |
853 |
myquery << " and FROM_TIME <= " << time; |
myquery << " and FROM_TIME <= " << time; |
854 |
myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
855 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
856 |
|
// printf(" mysquery is %s\n",myquery.str().c_str()); |
857 |
// |
// |
858 |
// if no results yet quit with error |
// if no results yet quit with error |
859 |
// |
// |
860 |
if( !pResult->GetRowCount() ) return (-54); |
if( !pResult->GetRowCount() ) return (-54); |
861 |
|
// |
862 |
|
Row = pResult->Next(); |
863 |
|
// |
864 |
}; |
}; |
865 |
// |
// |
866 |
// store infos and exit |
// store infos and exit |
867 |
// |
// |
|
Row = pResult->Next(); |
|
868 |
if( Row == NULL ) return (-54); |
if( Row == NULL ) return (-54); |
869 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
870 |
if (t==0) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t==0) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
892 |
// ---------------- |
// ---------------- |
893 |
myquery.str(""); |
myquery.str(""); |
894 |
myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time; |
myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time; |
895 |
myquery << " AND VALIDATION = 1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
896 |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
// myquery << " ORDER BY FROM_TIME DESC LIMIT 1;"; |
897 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
898 |
if(!pResult->GetRowCount())return (-55);//throw -55; |
if(!pResult->GetRowCount())return (-55);//throw -55; |
1105 |
return(pkt_num); |
return(pkt_num); |
1106 |
// |
// |
1107 |
}; |
}; |
1108 |
|
|
1109 |
|
/* |
1110 |
|
* |
1111 |
|
* Convert the time in the DB from UInt_t to a string |
1112 |
|
* |
1113 |
|
* @param dbt time in the DB |
1114 |
|
* @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK |
1115 |
|
* |
1116 |
|
*/ |
1117 |
|
TString GL_TIMESYNC::ConvertTime(TString tzone, UInt_t dbt){ |
1118 |
|
// |
1119 |
|
TDatime *time = new TDatime(); |
1120 |
|
TString rtime; |
1121 |
|
// |
1122 |
|
time->Set(dbt,false); // MSK = Moscow Winter Time |
1123 |
|
// |
1124 |
|
if ( !strcmp(tzone.Data(),"UTC") || !strcmp(tzone.Data(),"GMT") ){ |
1125 |
|
// |
1126 |
|
UInt_t timeUTC = time->Convert() - 60*60*3; // UTC (Coordinated Universal Time) = Moscow Winter Time - 3 hs |
1127 |
|
time->Set(timeUTC,false); |
1128 |
|
// |
1129 |
|
}; |
1130 |
|
// |
1131 |
|
if ( !strcmp(tzone.Data(),"CET") ){ |
1132 |
|
// |
1133 |
|
UInt_t timeCET = time->Convert() - 60*60*2; // CET (Central European Time) = Moscow Winter Time - 2 hs |
1134 |
|
time->Set(timeCET,false); |
1135 |
|
// |
1136 |
|
}; |
1137 |
|
// |
1138 |
|
if ( !strcmp(tzone.Data(),"CEST") ){ |
1139 |
|
// |
1140 |
|
UInt_t timeCEST = time->Convert() - 60*60*1; // CEST (Central European Summer Time) = Moscow Winter Time - 1 h |
1141 |
|
time->Set(timeCEST,false); |
1142 |
|
// |
1143 |
|
}; |
1144 |
|
// |
1145 |
|
if ( !strcmp(tzone.Data(),"MSD") ){ |
1146 |
|
// |
1147 |
|
UInt_t timeMSD = time->Convert() + 60*60*1; // MSD (Moscow Summer Time) = Moscow Winter Time + 1 h |
1148 |
|
time->Set(timeMSD,false); |
1149 |
|
// |
1150 |
|
}; |
1151 |
|
// |
1152 |
|
rtime = time->AsSQLString(); |
1153 |
|
// |
1154 |
|
return(rtime); |
1155 |
|
} |
1156 |
|
|
1157 |
|
/* |
1158 |
|
* |
1159 |
|
* Convert the time in the DB from UInt_t to a string |
1160 |
|
* |
1161 |
|
* @param dbt time in the DB |
1162 |
|
* @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK |
1163 |
|
* |
1164 |
|
*/ |
1165 |
|
TString GL_TIMESYNC::UnConvertTime(TString tzone, UInt_t dbt){ |
1166 |
|
// |
1167 |
|
TDatime *time = new TDatime(); |
1168 |
|
TString rtime; |
1169 |
|
// |
1170 |
|
time->Set(dbt,false); // MSK = Moscow Winter Time |
1171 |
|
// |
1172 |
|
if ( !strcmp(tzone.Data(),"UTC") || !strcmp(tzone.Data(),"GMT") ){ |
1173 |
|
// |
1174 |
|
UInt_t timeUTC = time->Convert() + 60*60*3; // UTC (Coordinated Universal Time) +3 hs = Moscow Winter Time |
1175 |
|
time->Set(timeUTC,false); |
1176 |
|
// |
1177 |
|
}; |
1178 |
|
// |
1179 |
|
if ( !strcmp(tzone.Data(),"CET") ){ |
1180 |
|
// |
1181 |
|
UInt_t timeCET = time->Convert() + 60*60*2; // CET (Central European Time) + 2 hs = Moscow Winter Time |
1182 |
|
time->Set(timeCET,false); |
1183 |
|
// |
1184 |
|
}; |
1185 |
|
// |
1186 |
|
if ( !strcmp(tzone.Data(),"CEST") ){ |
1187 |
|
// |
1188 |
|
UInt_t timeCEST = time->Convert() + 60*60*1; // CEST (Central European Summer Time) + 1 h = Moscow Winter Time |
1189 |
|
time->Set(timeCEST,false); |
1190 |
|
// |
1191 |
|
}; |
1192 |
|
// |
1193 |
|
if ( !strcmp(tzone.Data(),"MSD") ){ |
1194 |
|
// |
1195 |
|
UInt_t timeMSD = time->Convert() - 60*60*1; // MSD (Moscow Summer Time) - 1 h = Moscow Winter Time |
1196 |
|
time->Set(timeMSD,false); |
1197 |
|
// |
1198 |
|
}; |
1199 |
|
// |
1200 |
|
rtime = time->AsSQLString(); |
1201 |
|
// |
1202 |
|
return(rtime); |
1203 |
|
} |