Fixed wrong date generation in file conversion to PSI-BIN

This commit is contained in:
nemu 2014-08-28 14:35:17 +02:00
parent c03a5bc317
commit c3214e4829

View File

@ -5149,7 +5149,15 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln)
vector<string> svec; vector<string> svec;
TString str, date; TString str, date;
TDatime dt; TDatime dt;
dt.Set(fData[0].GetStartDateTime()); int year, month, day;
// 28-Aug-2014, TP: the following line does not work, it generates the wrong date
//dt.Set(fData[0].GetStartDateTime());
// the following generates the correct date entry
date.Append(*fData[0].GetStartDate());
sscanf((const char*)date.Data(),"%04d-%02d-%02d", &year, &month, &day);
dt.Set(year, month, day, 0, 0, 0);
date.Form("%02d-", dt.GetDay()); date.Form("%02d-", dt.GetDay());
date.Append(GetMonth(dt.GetMonth())); date.Append(GetMonth(dt.GetMonth()));
date.Append("-"); date.Append("-");
@ -5165,7 +5173,14 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln)
svec.clear(); svec.clear();
// run stop date // run stop date
dt.Set(fData[0].GetStopDateTime()); // 28-Aug-2014, TP: the following line does not work, it generates the wrong date
//dt.Set(fData[0].GetStopDateTime());
// the following generates the correct date entry
date.Clear();
date.Append(*fData[0].GetStopDate());
sscanf((const char*)date.Data(),"%04d-%02d-%02d", &year, &month, &day);
dt.Set(year, month, day, 0, 0, 0);
date.Form("%02d-", dt.GetDay()); date.Form("%02d-", dt.GetDay());
date.Append(GetMonth(dt.GetMonth())); date.Append(GetMonth(dt.GetMonth()));
date.Append("-"); date.Append("-");