OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Timestamp.h
Go to the documentation of this file.
1 #ifndef __TIMESTAMP_H__
2 #define __TIMESTAMP_H__
3 
4 #include <sstream>
5 #include <boost/chrono.hpp>
6 #include <ctime>
7 
9 
10 #include "mpi.h"
11 
12 class Timestamp : public TraceComponent {
13 
14 public:
15 
16 
18  : TraceComponent("Timestamp")
19  {}
20 
21  void execute(std::ostringstream &dump) {
22 
23  boost::chrono::time_point<boost::chrono::system_clock> now;
24  now = boost::chrono::system_clock::now();
25  std::time_t now_time = boost::chrono::system_clock::to_time_t(now);
26 
27  std::ostringstream timestamp;
28  timestamp << std::ctime(&now_time);
29 
30  prepend(dump, timestamp);
31  }
32 
33  virtual ~Timestamp()
34  {}
35 
36 };
37 
38 #endif
void execute(std::ostringstream &dump)
Definition: Timestamp.h:21
virtual ~Timestamp()
Definition: Timestamp.h:33
void prepend(std::ostringstream &dump, std::ostringstream &prepender)
Timestamp()
Definition: Timestamp.h:17