added getTime_ns() in macro.h
This commit is contained in:
parent
792d1c5545
commit
5c6b5e7001
9
macro.h
9
macro.h
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <sys/time.h> /** struct timeval, select() */
|
#include <sys/time.h> /** struct timeval, select() */
|
||||||
|
|
||||||
inline unsigned int get_time(){
|
inline unsigned int get_time_us(){
|
||||||
unsigned int time_us;
|
unsigned int time_us;
|
||||||
struct timeval t1;
|
struct timeval t1;
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
|
@ -31,6 +31,13 @@ inline unsigned int get_time(){
|
||||||
return time_us;
|
return time_us;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
inline unsigned long long getTime_ns(){
|
||||||
|
std::chrono::high_resolution_clock::time_point currentTime = std::chrono::high_resolution_clock::now();
|
||||||
|
std::chrono::nanoseconds nanoseconds = std::chrono::duration_cast<std::chrono::nanoseconds>(currentTime.time_since_epoch());
|
||||||
|
return nanoseconds.count();
|
||||||
|
}
|
||||||
|
|
||||||
typedef unsigned short uShort;
|
typedef unsigned short uShort;
|
||||||
typedef unsigned int uInt;
|
typedef unsigned int uInt;
|
||||||
typedef unsigned long uLong;
|
typedef unsigned long uLong;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user