Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F127029
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/util/timedifference.cpp b/util/timedifference.cpp
index 50e7ba34..578e4bbd 100644
--- a/util/timedifference.cpp
+++ b/util/timedifference.cpp
@@ -1,35 +1,37 @@
#include "timedifference.h"
+#include <sstream>
#include <iostream>
#include <string>
using namespace std;
TimeDifference::TimeDifference(){
start.tv_usec = 0;
start.tv_sec = 0;
end.tv_usec = 0;
end.tv_sec = 0;
}
-void TimeDifference::printTime(){
-
- this->printTime("Function");
-
+const string TimeDifference::printTime(){
+ return this->printTime("Function");
}
unsigned long long int TimeDifference::getTime(){
unsigned long long int g = (end.tv_sec*1000000+end.tv_usec) - (start.tv_sec*1000000 + start.tv_usec );
return g;
}
-void TimeDifference::printTime( const string & s ){
+const string TimeDifference::printTime( const string & s ){
unsigned long long int micro = (end.tv_sec*1000000+end.tv_usec) - (start.tv_sec*1000000 + start.tv_usec );
unsigned long long int milli = micro / 1000;
unsigned long long int sec = milli / 1000;
- cout<<s<<" took "<<micro<<" microseconds / "<< milli << " milliseconds / " <<sec<< " seconds "<< endl;
+ //cout<<s<<" took "<<micro<<" microseconds / "<< milli << " milliseconds / " <<sec<< " seconds "<< endl;
+ ostringstream o;
+ o << s <<" took "<<micro<<" microseconds / "<< milli << " milliseconds / " <<sec<< " seconds";
+ return o.str();
}
TimeDifference::~TimeDifference(){
}
diff --git a/util/timedifference.h b/util/timedifference.h
index 410872c4..3a882af4 100644
--- a/util/timedifference.h
+++ b/util/timedifference.h
@@ -1,39 +1,39 @@
#ifndef _time_difference_h
#define _time_difference_h
#include <time.h>
#include <sys/time.h>
#include <string>
using namespace std;
class TimeDifference{
public:
TimeDifference();
inline void startTime(){
#ifndef WINDOWS
gettimeofday( &start, NULL );
#endif
}
inline void endTime(){
#ifndef WINDOWS
gettimeofday( &end, NULL );
#endif
}
unsigned long long int getTime();
- void printTime();
- void printTime( const string & s );
+ const string printTime();
+ const string printTime( const string & s );
~TimeDifference();
protected:
struct timeval start, end;
};
#endif
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Jun 11, 2:06 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
69385
Default Alt Text
(2 KB)
Attached To
Mode
R75 R-Tech1
Attached
Detach File
Event Timeline