From 5c6b5e700144a62adf046f308e15675a57abb0e0 Mon Sep 17 00:00:00 2001 From: splitPoleDAQ Date: Fri, 19 Jan 2024 03:07:55 -0500 Subject: [PATCH] added getTime_ns() in macro.h --- macro.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/macro.h b/macro.h index aab619e..77d57c1 100644 --- a/macro.h +++ b/macro.h @@ -22,7 +22,7 @@ #include /** struct timeval, select() */ -inline unsigned int get_time(){ +inline unsigned int get_time_us(){ unsigned int time_us; struct timeval t1; struct timezone tz; @@ -31,6 +31,13 @@ inline unsigned int get_time(){ return time_us; } +#include +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(currentTime.time_since_epoch()); + return nanoseconds.count(); +} + typedef unsigned short uShort; typedef unsigned int uInt; typedef unsigned long uLong;