1114 |
* @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK |
* @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){ |
TString GL_TIMESYNC::ConvertTime(TString &tzone, UInt_t dbt){ |
1118 |
// |
// |
1119 |
TDatime *time = new TDatime(); |
TDatime *time = new TDatime(); |
1120 |
TString rtime; |
TString rtime; |
1121 |
|
Bool_t found = false; |
1122 |
// |
// |
1123 |
time->Set(dbt,false); // MSK = Moscow Winter Time |
time->Set(dbt,false); // MSK = Moscow Winter Time |
1124 |
// |
// |
1126 |
// |
// |
1127 |
UInt_t timeUTC = time->Convert() - 60*60*3; // UTC (Coordinated Universal Time) = Moscow Winter Time - 3 hs |
UInt_t timeUTC = time->Convert() - 60*60*3; // UTC (Coordinated Universal Time) = Moscow Winter Time - 3 hs |
1128 |
time->Set(timeUTC,false); |
time->Set(timeUTC,false); |
1129 |
|
found = true; |
1130 |
// |
// |
1131 |
}; |
}; |
1132 |
// |
// |
1134 |
// |
// |
1135 |
UInt_t timeCET = time->Convert() - 60*60*2; // CET (Central European Time) = Moscow Winter Time - 2 hs |
UInt_t timeCET = time->Convert() - 60*60*2; // CET (Central European Time) = Moscow Winter Time - 2 hs |
1136 |
time->Set(timeCET,false); |
time->Set(timeCET,false); |
1137 |
|
found = true; |
1138 |
// |
// |
1139 |
}; |
}; |
1140 |
// |
// |
1142 |
// |
// |
1143 |
UInt_t timeCEST = time->Convert() - 60*60*1; // CEST (Central European Summer Time) = Moscow Winter Time - 1 h |
UInt_t timeCEST = time->Convert() - 60*60*1; // CEST (Central European Summer Time) = Moscow Winter Time - 1 h |
1144 |
time->Set(timeCEST,false); |
time->Set(timeCEST,false); |
1145 |
|
found = true; |
1146 |
// |
// |
1147 |
}; |
}; |
1148 |
// |
// |
1150 |
// |
// |
1151 |
UInt_t timeMSD = time->Convert() + 60*60*1; // MSD (Moscow Summer Time) = Moscow Winter Time + 1 h |
UInt_t timeMSD = time->Convert() + 60*60*1; // MSD (Moscow Summer Time) = Moscow Winter Time + 1 h |
1152 |
time->Set(timeMSD,false); |
time->Set(timeMSD,false); |
1153 |
|
found = true; |
1154 |
// |
// |
1155 |
}; |
}; |
1156 |
// |
// |
1157 |
|
if ( !found && strcmp(tzone.Data(),"MSK") && strcmp(tzone.Data(),"") ){ |
1158 |
|
printf("\n Unknown time zone %s using MSK \n",tzone.Data()); |
1159 |
|
tzone = "MSK"; |
1160 |
|
}; |
1161 |
|
// |
1162 |
rtime = time->AsSQLString(); |
rtime = time->AsSQLString(); |
1163 |
// |
// |
1164 |
return(rtime); |
return(rtime); |
1172 |
* @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK |
* @param tzone Time Zone, can be UTC,GMT,CET,CEST,MSD default is MSK |
1173 |
* |
* |
1174 |
*/ |
*/ |
1175 |
TString GL_TIMESYNC::UnConvertTime(TString tzone, UInt_t dbt){ |
TString GL_TIMESYNC::UnConvertTime(TString &tzone, UInt_t dbt){ |
1176 |
// |
// |
1177 |
TDatime *time = new TDatime(); |
TDatime *time = new TDatime(); |
1178 |
TString rtime; |
TString rtime; |
1179 |
// |
// |
1180 |
|
Bool_t found = false; |
1181 |
|
// |
1182 |
time->Set(dbt,false); // MSK = Moscow Winter Time |
time->Set(dbt,false); // MSK = Moscow Winter Time |
1183 |
// |
// |
1184 |
if ( !strcmp(tzone.Data(),"UTC") || !strcmp(tzone.Data(),"GMT") ){ |
if ( !strcmp(tzone.Data(),"UTC") || !strcmp(tzone.Data(),"GMT") ){ |
1185 |
// |
// |
1186 |
UInt_t timeUTC = time->Convert() + 60*60*3; // UTC (Coordinated Universal Time) +3 hs = Moscow Winter Time |
UInt_t timeUTC = time->Convert() + 60*60*3; // UTC (Coordinated Universal Time) +3 hs = Moscow Winter Time |
1187 |
time->Set(timeUTC,false); |
time->Set(timeUTC,false); |
1188 |
|
found = true; |
1189 |
// |
// |
1190 |
}; |
}; |
1191 |
// |
// |
1193 |
// |
// |
1194 |
UInt_t timeCET = time->Convert() + 60*60*2; // CET (Central European Time) + 2 hs = Moscow Winter Time |
UInt_t timeCET = time->Convert() + 60*60*2; // CET (Central European Time) + 2 hs = Moscow Winter Time |
1195 |
time->Set(timeCET,false); |
time->Set(timeCET,false); |
1196 |
|
found = true; |
1197 |
// |
// |
1198 |
}; |
}; |
1199 |
// |
// |
1201 |
// |
// |
1202 |
UInt_t timeCEST = time->Convert() + 60*60*1; // CEST (Central European Summer Time) + 1 h = Moscow Winter Time |
UInt_t timeCEST = time->Convert() + 60*60*1; // CEST (Central European Summer Time) + 1 h = Moscow Winter Time |
1203 |
time->Set(timeCEST,false); |
time->Set(timeCEST,false); |
1204 |
|
found = true; |
1205 |
// |
// |
1206 |
}; |
}; |
1207 |
// |
// |
1208 |
if ( !strcmp(tzone.Data(),"MSD") ){ |
if ( !strcmp(tzone.Data(),"MSD") || !strcmp(tzone.Data(),"MST") ){ |
1209 |
// |
// |
1210 |
UInt_t timeMSD = time->Convert() - 60*60*1; // MSD (Moscow Summer Time) - 1 h = Moscow Winter Time |
UInt_t timeMSD = time->Convert() - 60*60*1; // MSD (Moscow Summer Time) - 1 h = Moscow Winter Time |
1211 |
time->Set(timeMSD,false); |
time->Set(timeMSD,false); |
1212 |
|
found = true; |
1213 |
|
// |
1214 |
|
}; |
1215 |
|
// |
1216 |
|
if ( !found && strcmp(tzone.Data(),"MSK") && strcmp(tzone.Data(),"") ){ |
1217 |
// |
// |
1218 |
|
printf("\n Unknown time zone %s using MSK \n",tzone.Data()); |
1219 |
|
tzone = "MSK"; |
1220 |
}; |
}; |
1221 |
// |
// |
1222 |
rtime = time->AsSQLString(); |
rtime = time->AsSQLString(); |