All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
lariov::TimeStampDecoder Class Reference

#include <TimeStampDecoder.h>

Public Member Functions

 TimeStampDecoder ()
 
virtual ~TimeStampDecoder ()
 

Static Public Member Functions

static IOVTimeStamp DecodeTimeStamp (DBTimeStamp_t ts)
 

Detailed Description

Definition at line 9 of file TimeStampDecoder.h.

Constructor & Destructor Documentation

lariov::TimeStampDecoder::TimeStampDecoder ( )
inline

Definition at line 13 of file TimeStampDecoder.h.

13 {}
virtual lariov::TimeStampDecoder::~TimeStampDecoder ( )
virtual

Member Function Documentation

IOVTimeStamp lariov::TimeStampDecoder::DecodeTimeStamp ( DBTimeStamp_t  ts)
static

Definition at line 10 of file TimeStampDecoder.cxx.

10  {
11 
12  std::string time = std::to_string(ts);
13 
14  //microboone stores timestamp as ns from epoch, so there should be 19 digits.
15  if (time.length() == 19) {
16  //make timestamp conform to database precision
17  time = time.substr(0, 10+kMAX_SUBSTAMP_LENGTH);
18 
19  //insert decimal point
20  time.insert(10,".");
21 
22  //finish construction
23  IOVTimeStamp tmp = IOVTimeStamp::GetFromString(time);
24  return tmp;
25  }
26  else if (time.length() < kMAX_SUBSTAMP_LENGTH && ts!=0) {
27  IOVTimeStamp tmp = IOVTimeStamp::GetFromString(time);
28  return tmp;
29  }
30  else {
31  std::string msg = "TimeStampDecoder: I do not know how to convert this timestamp: " + time;
32  throw IOVDataError(msg);
33  }
34  }
std::string to_string(WindowPattern const &pattern)
const unsigned short kMAX_SUBSTAMP_LENGTH
static IOVTimeStamp GetFromString(const std::string &ts)

The documentation for this class was generated from the following files: