File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change 1313#ifndef ROOT_Math_Util
1414#define ROOT_Math_Util
1515
16+ #include < chrono>
1617#include < cmath>
1718#include < functional>
1819#include < limits>
@@ -51,7 +52,7 @@ class TimingScope {
5152 ~TimingScope ();
5253
5354private:
54- void * fBegin ;
55+ std::chrono::steady_clock::time_point fBegin ;
5556 std::function<void (std::string const &)> fPrinter ;
5657 const std::string fMessage ;
5758};
Original file line number Diff line number Diff line change 11#include " Math/Util.h"
22
3- #include < chrono>
4-
53ROOT::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}
75{
8- using std::chrono::steady_clock;
9- fBegin = new steady_clock::time_point{steady_clock::now ()};
106}
117
128namespace {
@@ -59,10 +55,8 @@ std::string printTime(T duration)
5955ROOT::Math::Util::TimingScope::~TimingScope ()
6056{
6157 using std::chrono::steady_clock;
62- auto *begin = reinterpret_cast <steady_clock::time_point *>(fBegin );
6358 steady_clock::time_point end = steady_clock::now ();
6459 std::stringstream ss;
65- ss << fMessage << " " << printTime (end - *begin );
60+ ss << fMessage << " " << printTime (end - fBegin );
6661 fPrinter (ss.str ());
67- delete begin;
6862}
You can’t perform that action at this time.
0 commit comments