123456789101112131415161718192021 |
- #ifndef _INCLUDE_TIME_STAMP_HPP
- #define _INCLUDE_TIME_STAMP_HPP
- #include <sys/timeb.h>
- #ifndef WIN32
- #include <sys/time.h>
- #endif
- struct TIME{
- static uint64_t getMilliseconds()
- {
- #ifndef WIN32
- struct timeval tv;
- ::gettimeofday(&tv, 0);
- return tv.tv_sec*1000+tv.tv_usec/1000;
- #else
- struct timeb tb;
- ::ftime(&tb);
- return tb.time*1000+tb.millitm;
- #endif
- }
- };
- #endif
|