From e2c3dcd9064cc656c827a531ed6b9f438fd15a85 Mon Sep 17 00:00:00 2001 From: emanuel Date: Thu, 17 Feb 2022 12:45:24 +0000 Subject: [PATCH] Microseconds tolling timestamps for test results --- src/tpm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/tpm.c b/src/tpm.c index d8f2259..a173212 100644 --- a/src/tpm.c +++ b/src/tpm.c @@ -34,7 +34,11 @@ int tpm_pay(void* fc, uint8_t* neighbour) { facilities_t* facilities = (facilities_t*) fc; tolling_s* tolling = (tolling_s*) &facilities->tolling; - tolling->tz = it2s_tender_get_clock(&facilities->epv) ; + pthread_mutex_lock(&facilities->epv.time.lock); + facilities->epv.time.resolution = TIME_MICROSECONDS; + tolling->tz = it2s_tender_get_time(&facilities->epv) ; + facilities->epv.time.resolution = TIME_MILLISECONDS; + pthread_mutex_unlock(&facilities->epv.time.lock); TransportRequest_t* tr = NULL; SecurityRequest_t* sreq = NULL; @@ -469,7 +473,11 @@ int tpm_recv(void* fc, TPM_t* tpm_rx, uint8_t* neighbour) { syslog_debug("[facilities] [tolling] received TPM.reply, ignoring"); goto cleanup; } - syslog_info("[facilities] [tolling] reply took %ld ms", it2s_tender_get_clock(&facilities->epv) - tolling->tz); + pthread_mutex_lock(&facilities->epv.time.lock); + facilities->epv.time.resolution = TIME_MICROSECONDS; + syslog_info("[facilities] [tolling] reply took %ld us", it2s_tender_get_time(&facilities->epv) - tolling->tz); + facilities->epv.time.resolution = TIME_MILLISECONDS; + pthread_mutex_unlock(&facilities->epv.time.lock); veh_handle_recv(tolling, tpm_rx, neighbour); break;