CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
pos::PixelTimeFormatter Class Reference

#include <PixelTimeFormatter.h>

Public Member Functions

struct timeval getImSecTime (void)
 
struct tm * getITime (void)
 
 PixelTimeFormatter (std::string source)
 
void stopTimer (void)
 

Static Public Member Functions

static std::string getmSecTime (void)
 
static std::string getTime (void)
 

Private Attributes

struct timeval endTime_
 
std::string origin_
 
struct timeval startTime_
 
bool verbose_
 

Detailed Description

Definition at line 27 of file PixelTimeFormatter.h.

Constructor & Destructor Documentation

pos::PixelTimeFormatter::PixelTimeFormatter ( std::string  source)
inline

Definition at line 32 of file PixelTimeFormatter.h.

References gather_cfg::cout, getImSecTime(), origin_, hitfit::return, LaserTracksInput_cfi::source, startTime_, and USE_TIMER_.

33  {
34  if( !USE_TIMER_) return ;
35  origin_ = source ;
36  std::cout << "[PixelTimeFormatter::PixelTimeFormatter()]\t\t Time counter started for " << origin_ << std::endl ;
38  }
struct timeval getImSecTime(void)
tuple cout
Definition: gather_cfg.py:121
#define USE_TIMER_

Member Function Documentation

struct timeval pos::PixelTimeFormatter::getImSecTime ( void  )
inline

Definition at line 96 of file PixelTimeFormatter.h.

Referenced by PixelTimeFormatter(), and stopTimer().

97  {
98  struct timeval msecTime;
99  gettimeofday(&msecTime, (struct timezone *)0) ;
100 
101  return msecTime ;
102  }
struct tm* pos::PixelTimeFormatter::getITime ( void  )
inline

Definition at line 72 of file PixelTimeFormatter.h.

References cond::rpcobgas::time.

73  {
74  struct tm *thisTime;
75  time_t aclock;
76  time( &aclock );
77  thisTime = localtime( &aclock );
78  return thisTime ;
79  }
static std::string pos::PixelTimeFormatter::getmSecTime ( void  )
inlinestatic
static std::string pos::PixelTimeFormatter::getTime ( void  )
inlinestatic

Definition at line 50 of file PixelTimeFormatter.h.

References cond::rpcobgas::time.

Referenced by pos::PixelFEDCard::writeXML(), pos::PixelDetectorConfig::writeXML(), pos::PixelNameTranslation::writeXML(), pos::PixelTTCciConfig::writeXMLHeader(), pos::PixelDelay25Calib::writeXMLHeader(), pos::PixelMaxVsf::writeXMLHeader(), pos::PixelPortCardConfig::writeXMLHeader(), pos::PixelMaskAllPixels::writeXMLHeader(), pos::PixelLowVoltageMap::writeXMLHeader(), pos::PixelLTCConfig::writeXMLHeader(), pos::PixelGlobalDelay25::writeXMLHeader(), pos::PixelFECConfig::writeXMLHeader(), pos::PixelTBMSettings::writeXMLHeader(), pos::PixelTrimAllPixels::writeXMLHeader(), pos::PixelFEDConfig::writeXMLHeader(), pos::PixelTKFECConfig::writeXMLHeader(), pos::PixelFEDCard::writeXMLHeader(), pos::PixelDetectorConfig::writeXMLHeader(), pos::PixelPortcardMap::writeXMLHeader(), pos::PixelDACSettings::writeXMLHeader(), pos::PixelNameTranslation::writeXMLHeader(), and pos::PixelCalibConfiguration::writeXMLHeader().

51  {
52  char theDate[20] ;
53  struct tm *thisTime;
54  time_t aclock;
55  std::string date ;
56  time( &aclock );
57  thisTime = localtime( &aclock );
58 
59  sprintf(theDate,
60  "%d-%02d-%02d %02d:%02d:%02d", thisTime->tm_year+1900,
61  thisTime->tm_mon+1,
62  thisTime->tm_mday,
63  thisTime->tm_hour,
64  thisTime->tm_min,
65  thisTime->tm_sec );
66  date = theDate ;
67  //std::cout << "[PixelTimeFormatter::getTime()]\t\t\t\t Time: " << date << std::endl ;
68  return date ;
69  }
void pos::PixelTimeFormatter::stopTimer ( void  )
inline

Definition at line 40 of file PixelTimeFormatter.h.

References gather_cfg::cout, endTime_, getImSecTime(), origin_, hitfit::return, errorMatrix2Lands_multiChannel::start, startTime_, and USE_TIMER_.

41  {
42  if( !USE_TIMER_ ) return ;
44  double start = startTime_.tv_sec + startTime_.tv_usec/1000000. ;
45  double stop = endTime_.tv_sec + endTime_.tv_usec/1000000. ;
46  std::cout << "[PixelTimeFormatter::stopTimer()]\t\t\t Elapsed time: " << stop-start << " seconds for " << origin_ << std::endl ;
47  }
struct timeval getImSecTime(void)
tuple cout
Definition: gather_cfg.py:121
#define USE_TIMER_

Member Data Documentation

struct timeval pos::PixelTimeFormatter::endTime_
private

Definition at line 140 of file PixelTimeFormatter.h.

Referenced by stopTimer().

std::string pos::PixelTimeFormatter::origin_
private

Definition at line 141 of file PixelTimeFormatter.h.

Referenced by PixelTimeFormatter(), and stopTimer().

struct timeval pos::PixelTimeFormatter::startTime_
private

Definition at line 139 of file PixelTimeFormatter.h.

Referenced by PixelTimeFormatter(), and stopTimer().

bool pos::PixelTimeFormatter::verbose_
private

Definition at line 142 of file PixelTimeFormatter.h.