TimingSimulationContext.cpp

Go to the documentation of this file.
00001 //Copyright GSI 2012
00002 #include <fesa-core-gsi/Synchronization/TimingSimulationContext.h>
00003 #include <sys/time.h>
00004 
00005 namespace fesaGSI
00006 {
00007     TimingSimulationContext::TimingSimulationContext(std::string& domainName, long cycleId, std::string& cycleName,long relativEventTimeInCycle) :
00008         fesa::MultiplexingContext()
00009     {
00010         cycleName_ =   domainName + ".USER." + cycleName;
00011         cycleId_ = cycleId;
00012         timingDomainName_ = domainName;
00013         timingDomainId_ = 0;
00014         type_ = fesa::MultiplexingContext::CycleOccurrenceCtxt;
00015         cycleTime_ = relativEventTimeInCycle;
00016     }
00017 
00018     long long TimingSimulationContext::getInterruptTimeStamp()
00019     {
00020         return cycleStamp_;
00021     }
00022 
00023     unsigned long TimingSimulationContext::getCycleTime()
00024     {
00025         return cycleTime_;
00026     }
00027 
00028     void TimingSimulationContext::setCycleTimeStamp()
00029     {
00030         struct timeval tv;
00031         gettimeofday(&tv, 0);
00032 
00033         //cyclestamp_ is in nanoseconds, so we have to calculate
00034         cycleStamp_ = tv.tv_sec * (long long) 1000000000 + tv.tv_usec * (long long) 1000;
00035     }
00036 
00037 }//end namespace

Generated on 25 Jan 2013 for fesa-core-gsi by  doxygen 1.6.1