From c3214e482919c9b18e8750ddb297db2f1608bca7 Mon Sep 17 00:00:00 2001 From: nemu Date: Thu, 28 Aug 2014 14:35:17 +0200 Subject: [PATCH] Fixed wrong date generation in file conversion to PSI-BIN --- src/classes/PRunDataHandler.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index 1f3b0d93..1c25833d 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -5149,7 +5149,15 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) vector svec; TString str, date; 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.Append(GetMonth(dt.GetMonth())); date.Append("-"); @@ -5165,7 +5173,14 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) svec.clear(); // 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.Append(GetMonth(dt.GetMonth())); date.Append("-");