// // Created by Scheaven on 2020/5/14. // #ifndef DEMO_TIME_UTIL_H #define DEMO_TIME_UTIL_H #include #include #include #include #include #include #include int get_run_time(struct timeval *result, struct timeval *begin, struct timeval *end); time_t strTime2unix(char* timeStamp); long char_2_unix(char* str1); char* fa_getSysTime(); std::string random_int(size_t length); #include #include "log_util.h" #include class Timer { public: static Timer* instance; static Timer* getInstance(); Timer(); public: void reset(); double elapsed() const; void out(std::string message=""); // DEBUG((boost::format("nhao%d")%1).str()); double get_duration() const; private: using clock_ = std::chrono::high_resolution_clock; using second_=std::chrono::duration; std::chrono::time_pointbeg_; }; #endif //DEMO_TIME_UTIL_H