Commit b4c64db9 authored by legoc's avatar legoc

Implemented different reading when version = 1 and version > 1

parent bb42ecc4
......@@ -10,3 +10,4 @@
/ltmain.sh
/Makefile.in
/missing
/.settings/
......@@ -130,16 +130,20 @@ bool readEvent(Event & event, int32_t * buffer) {
// Use printBinary(buffer) to debug if necessary.
// Set the absolute time. Here the event is still in relative time.
/* time_type absoluteTime = event.time() * event.timeResolution();
// We can set the absolute time that changes the rollover and timestamp.
event.setTime(absoluteTime);
if (absoluteTime != event.time()) {
cerr << "Problem while converting relative time to absolute time" << endl;
// In version == 1, the event time in the file is relative so that the time resolution is used to convert to absolute time.
// In version >= 2, the event time in the file is already absolute.
if (listModeContext.version == 1) {
// Set the absolute time. Here the event is still in relative time.
time_type absoluteTime = event.time() * event.timeResolution();
// We can set the absolute time that changes the rollover and timestamp.
event.setTime(absoluteTime);
if (absoluteTime != event.time()) {
cerr << "Problem while converting relative time to absolute time" << endl;
}
}
*/
return true;
}
......@@ -147,11 +151,15 @@ void writeEvent(Event const & event, int32_t * buffer) {
Event relativeTimeEvent(event);
// We reset the event time to the relative time because we do not want to change the header of the lsto.
time_type relativeTime = event.time() / event.timeResolution();
// See comment on versions in readEvent.
if (listModeContext.version == 1) {
// We can set the absolute time that changes the rollover and timestamp.
relativeTimeEvent.setTime(relativeTime);
// We reset the event time to the relative time because we do not want to change the header of the lsto.
time_type relativeTime = event.time() / event.timeResolution();
// We can set the realtive time that changes the rollover and timestamp.
relativeTimeEvent.setTime(relativeTime);
}
*buffer = 0;
*buffer |= ((relativeTimeEvent.crate & 0xF) << 28);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment