From 11c495d26f6481176613f50215a5f12219601fe0 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 17 Jul 2023 18:56:02 +0200 Subject: [PATCH] Minor changes --- src/logger.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/logger.c b/src/logger.c index 3f49528..28e292c 100644 --- a/src/logger.c +++ b/src/logger.c @@ -103,10 +103,11 @@ int main (int argc, char *argv []) interval=INTERVAL(__loginterval); // Log current interval queue_id=(queue_id+1)>=MAX_QUEUES ? 0 : (queue_id+1); - printf("Queue id %d",queue_id); + // Write msg header: *queues[queue_id].msg='\0'; sprintf(queues[queue_id].msg,"%s\n%s\n%s\n%ld\n",ZMQ_TOKEN,__key,__client,interval); queues[queue_id].size=strlen(queues[queue_id].msg); + // Monitor: while((TIMESTAMP()-interval)<__loginterval){ if(__stop) break; @@ -114,6 +115,7 @@ int main (int argc, char *argv []) fgets(buffer,STATIC_LEN,regptr); // Get power measurement timestamp: clock_gettime(CLOCK_REALTIME,&power_ts); + // Write measurement into msg buffer: char line[MAX_RECORD_LEN]; if((queues[queue_id].size+MAX_RECORD_LEN)>ZMQ_MSG_SIZE){ printf("To many measurements to publish. Please increase ZMQ_MSG_SIZE\n"); @@ -140,7 +142,7 @@ int main (int argc, char *argv []) void publish(int queue_id, void* publisher){ - printf("Publishing...\n"); + printf("Publishing..."); zmq_send(publisher,queues[queue_id].msg,queues[queue_id].size,0); - printf("Done\n"); + printf("done\n"); } \ No newline at end of file