edits
[iotcloud.git] / version2 / src / C / TimingSingleton.h
index 4983f81..8083c04 100644 (file)
@@ -3,38 +3,37 @@
 #include <sys/time.h>
 
 class TimingSingleton {
- private:
-       static TimingSingleton singleton = new TimingSingleton( );
-       int64_t startTime = 0;
-       int64_t totalTime = 0;
-       
TimingSingleton() : startTime(0),
-               totalTime(0) {
+private:
+       int64_t fldstartTime;
+       int64_t fldtotalTime;
+
+ public:
      TimingSingleton() : fldstartTime(0),
+               fldtotalTime(0) {
        }
 
        int64_t nanoTime() {
                int64_t time;
                struct timeval tv;
                gettimeofday(&tv, NULL);
-               return tv.tv_sec*1000000000+tv.tv_usec*1000;
+               return tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
        }
-       
- public:
+
        void startTime() {
-               startTime = nanoTime();
+               fldstartTime = nanoTime();
        }
-       
+
        void endTime() {
-               totalTime += nanoTime() - startTime;
+               fldtotalTime += nanoTime() - fldstartTime;
        }
 
        int64_t getTime() {
-               return totalTime;
+               return fldtotalTime;
        }
 };
 
 TimingSingleton t_singleton;
-TimingSingleton * TimingSingleton_getInstance() {
+TimingSingleton *TimingSingleton_getInstance() {
        return &t_singleton;
 }
 #endif