MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
timer.hpp
1#ifndef MPQC_UTIL_TIMER_HPP
2#define MPQC_UTIL_TIMER_HPP
3
4#include <iostream>
5#include <boost/date_time/posix_time/posix_time_types.hpp>
6
7namespace mpqc {
8
9 struct timer {
10 typedef boost::posix_time::time_duration value_type;
11 boost::posix_time::ptime start_;
12 typedef boost::posix_time::microsec_clock microsec_clock;
13 timer() {
14 this->reset();
15 }
16 void reset() {
17 start_ = microsec_clock::universal_time();
18 }
19 boost::posix_time::time_duration duration() const {
20 return microsec_clock::universal_time() - start_;
21 }
22 operator value_type() const {
23 return duration();
24 }
25 operator double() const {
26 return duration().total_microseconds()/1e6;
27 }
28 long total_seconds() const {
29 return duration().total_seconds();
30 }
31 };
32
33 inline std::ostream& operator << (std::ostream &os, const timer &t) {
34 //os << boost::posix_time::to_simple_string(t.duration());
35 os << double(t);
36 return os;// << boost::posix_time::to_simple_string(t.duration());
37 }
38
39}
40
41#endif // MPQC_UTIL_TIMER_HPP
void operator<<(Array< T > A, const V &v)
Write to Array from a generic vector V.
Definition array.hpp:191
Contains new MPQC code since version 3.
Definition integralenginepool.hpp:37
Definition timer.hpp:9

Generated at Wed Sep 25 2024 02:45:30 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.