From cadbccc7654a40f16f96f2c48e584b998c03620e Mon Sep 17 00:00:00 2001
From: Filip Matusiak <filip.matusiak@iopsys.eu>
Date: Thu, 25 May 2023 10:15:19 +0200
Subject: [PATCH] Channel scan: compare UTC+0 alligned timestamp when cleaning
 old results

Signed-off-by: Filip Matusiak <filip.matusiak@iopsys.eu>
---
 src/cntlr_map.c   | 2 +-
 src/utils/utils.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cntlr_map.c b/src/cntlr_map.c
index dd9e56a4..07c26f88 100644
--- a/src/cntlr_map.c
+++ b/src/cntlr_map.c
@@ -3144,7 +3144,7 @@ static void cntlr_radio_remove_old_scanres(struct controller *c)
 			list_for_each_entry_safe(el, tmp, &r->radio_el->scanlist, list) {
 				struct timespec ts;
 
-				ts = timestamp_to_timespec(el->tsp, true);
+				ts = timestamp_to_timespec(el->tsp, false);
 				if (timestamp_expired(&ts, SCANRES_MAX_AGE * 1000)) {
 					cntlr_radio_clean_scanlist_el(el);
 					r->radio_el->num_scanresult--;
diff --git a/src/utils/utils.c b/src/utils/utils.c
index efbfca31..202506b6 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -266,6 +266,7 @@ static long int timestamp_get_off_sec(const char *tsp)
 	return toff;
 }
 
+/* Returns time alligned to UTC+0 */
 time_t timestamp_to_time(const char *tsp)
 {
 	struct tm tm_time;
-- 
GitLab