Class Reference for E1039 Core & Analysis Software
NMRUtil.h
Go to the documentation of this file.
1 #ifndef _NMR_UTIL__H_
2 #define _NMR_UTIL__H_
3 
4 namespace NMRUtil {
5 
6 void ConvEventNum(const int event_num, int& YYYY, int& MM, int& DD, int& hh, int& mm, int& ss)
7 {
8  TTimeStamp ts(event_num - TTimeStamp::GetZoneOffset());
9  int YYYYMMDD = ts.GetDate();
10  int hhmmss = ts.GetTime();
11  YYYY = YYYYMMDD / 10000;
12  MM = (YYYYMMDD % 10000) / 100;
13  DD = YYYYMMDD % 100;
14  hh = hhmmss / 10000;
15  mm = (hhmmss % 10000) / 100;
16  ss = hhmmss % 100;
17 }
18 
19 std::string ConvEventNum(const int event_num)
20 {
21  int YYYY, MM, DD, hh, mm, ss;
22  ConvEventNum(event_num, YYYY, MM, DD, hh, mm, ss);
23  ostringstream oss;
24  oss << setfill('0') << YYYY << "-" << setw(2) << MM << "-" << setw(2) << DD << " "
25  << setw(2) << hh << ":" << setw(2) << mm << ":" << setw(2) << ss;
26  return oss.str();
27 }
28 
29 };
30 
31 #endif // _NMR_UTIL__H_
Definition: NMRUtil.h:4
void ConvEventNum(const int event_num, int &YYYY, int &MM, int &DD, int &hh, int &mm, int &ss)
Definition: NMRUtil.h:6