Jpp  18.5.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDAQToolkit.hh
Go to the documentation of this file.
1 #ifndef __JDAQTOOLKIT__
2 #define __JDAQTOOLKIT__
3 
4 #include <cmath>
5 
6 #include "TTimeStamp.h"
7 
10 
11 
12 /**
13  * \file
14  *
15  * \author mdejong
16  */
17 namespace KM3NETDAQ {
18 
19  /**
20  * Get DAQ UTC time.
21  *
22  * \param t0 time stamp
23  * \param t1 time offset [ns]
24  * \return UTC time
25  */
26  JDAQUTCExtended getDAQUTCExtended(const TTimeStamp& t0, const double t1 = 0.0)
27  {
28  return JDAQUTCExtended(((double) t0.GetSec()) * 1.0e9 + ((double) t0.GetNanoSec()) - t1);
29  }
30 
31 
32  /**
33  * Get time stamp
34  *
35  * \param utc UTC time
36  * \param t1 time offset [ns]
37  * \return time stamp
38  */
39  TTimeStamp getTimeStamp(const JDAQUTCExtended& utc, const double t1 = 0.0)
40  {
41  TTimeStamp ts;
42 
43  const double t_ns = utc.getTimeNanoSecond() + t1;
44  const Int_t t_s = (Int_t) (t_ns / 1.0e9);
45 
46  ts.SetSec (t_s);
47  ts.SetNanoSec((Int_t) (t_ns - t_s * 1.0e9));
48 
49  return ts;
50  }
51 }
52 
53 #endif
Data structure for UTC time.
TTimeStamp getTimeStamp(const JDAQUTCExtended &utc, const double t1=0.0)
Get time stamp.
Definition: JDAQToolkit.hh:39
JDAQUTCExtended getDAQUTCExtended(const TTimeStamp &t0, const double t1=0.0)
Get DAQ UTC time.
Definition: JDAQToolkit.hh:26
double getTimeNanoSecond() const
Get time (limited to 16 ns cycles).