File tree 2 files changed +4
-9
lines changed
2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change 13
13
#ifndef ROOT_Math_Util
14
14
#define ROOT_Math_Util
15
15
16
+ #include < chrono>
16
17
#include < cmath>
17
18
#include < functional>
18
19
#include < limits>
@@ -51,7 +52,7 @@ class TimingScope {
51
52
~TimingScope ();
52
53
53
54
private:
54
- void * fBegin ;
55
+ std::chrono::steady_clock::time_point fBegin ;
55
56
std::function<void (std::string const &)> fPrinter ;
56
57
const std::string fMessage ;
57
58
};
Original file line number Diff line number Diff line change 1
1
#include " Math/Util.h"
2
2
3
- #include < chrono>
4
-
5
3
ROOT::Math::Util::TimingScope::TimingScope (std::function<void (std::string const &)> printer, std::string const &message)
6
- : fPrinter{printer}, fMessage {message}
4
+ : fBegin{ std::chrono::steady_clock::now ()}, fPrinter {printer}, fMessage {message}
7
5
{
8
- using std::chrono::steady_clock;
9
- fBegin = new steady_clock::time_point{steady_clock::now ()};
10
6
}
11
7
12
8
namespace {
@@ -59,10 +55,8 @@ std::string printTime(T duration)
59
55
ROOT::Math::Util::TimingScope::~TimingScope ()
60
56
{
61
57
using std::chrono::steady_clock;
62
- auto *begin = reinterpret_cast <steady_clock::time_point *>(fBegin );
63
58
steady_clock::time_point end = steady_clock::now ();
64
59
std::stringstream ss;
65
- ss << fMessage << " " << printTime (end - *begin );
60
+ ss << fMessage << " " << printTime (end - fBegin );
66
61
fPrinter (ss.str ());
67
- delete begin;
68
62
}
You can’t perform that action at this time.
0 commit comments