Skip to content

Commit

Permalink
Merge pull request #6651 from mommsen/useValidTimeStampInAnyCase_73
Browse files Browse the repository at this point in the history
Forward port timestamp fix to CMSSW_7_3
  • Loading branch information
cmsbuild committed Nov 27, 2014
2 parents bc029db + dded524 commit 447237f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
10 changes: 8 additions & 2 deletions EventFilter/Utilities/plugins/FedRawDataInputSource.cc
Expand Up @@ -41,6 +41,7 @@

#include "DataFormats/Provenance/interface/EventAuxiliary.h"
#include "DataFormats/Provenance/interface/EventID.h"
#include "DataFormats/Provenance/interface/Timestamp.h"


//JSON file reader
Expand Down Expand Up @@ -638,7 +639,13 @@ void FedRawDataInputSource::read(edm::EventPrincipal& eventPrincipal)

edm::Timestamp FedRawDataInputSource::fillFEDRawDataCollection(FEDRawDataCollection& rawData)
{
edm::Timestamp tstamp;
edm::TimeValue_t time;
timeval stv;
gettimeofday(&stv,0);
time = stv.tv_sec;
time = (time << 32) + stv.tv_usec;
edm::Timestamp tstamp(time);

uint32_t eventSize = event_->eventSize();
char* event = (char*)event_->payload();
GTPEventID_=0;
Expand Down Expand Up @@ -1178,4 +1185,3 @@ void FedRawDataInputSource::readNextChunkIntoBuffer(InputFile *file)

// define this class as an input source
DEFINE_FWK_INPUT_SOURCE( FedRawDataInputSource);

14 changes: 11 additions & 3 deletions EventFilter/Utilities/src/AuxiliaryMakers.cc
@@ -1,4 +1,7 @@
#include <sys/time.h>

#include "EventFilter/Utilities/interface/AuxiliaryMakers.h"

namespace evf{
namespace evtn{

Expand All @@ -13,10 +16,16 @@ namespace evf{

uint64_t gpsh = record->getBST().getBST().gpstimehigh;
uint32_t gpsl = record->getBST().getBST().gpstimelow;
edm::Timestamp tstamp = edm::Timestamp(static_cast<edm::TimeValue_t> ((gpsh << 32) + gpsl));
edm::TimeValue_t time = static_cast<edm::TimeValue_t> ((gpsh << 32) + gpsl);
if (time == 0) {
timeval stv;
gettimeofday(&stv,0);
time = stv.tv_sec;
time = (time << 32) + stv.tv_usec;
}
return edm::EventAuxiliary(eventId,
processGUID,
tstamp,
edm::Timestamp(time),
true,
(edm::EventAuxiliary::ExperimentType)(FED_EVTY_EXTRACT(record->getFEDHeader().getData().header.eventid)),
(int)record->getHeader().getData().header.bcid,
Expand All @@ -25,4 +34,3 @@ namespace evf{
}
}
}

0 comments on commit 447237f

Please sign in to comment.