diff Discovery/Src/data_central.c @ 949:c6b858f2e025 Evo_2_23 tip

GNSS UTC in Date-Time menu: The UTC time provided by the gnss module is not shown in the date-time settings menu. If a valid time signal is available then the OSTC RTC may be set to it by selecting the UTC menu entry. The time zone has to be selected manually. This is possible using a separate edit line.
author Ideenmodellierer
date Sun, 22 Dec 2024 21:19:21 +0100
parents aad1a6b9aaec
children
line wrap: on
line diff
--- a/Discovery/Src/data_central.c	Sun Dec 22 21:15:05 2024 +0100
+++ b/Discovery/Src/data_central.c	Sun Dec 22 21:19:21 2024 +0100
@@ -1095,3 +1095,31 @@
 	*pColor = color;
 	return drawingActive;
 }
+
+void convertUTCToLocal(uint8_t utcHours, uint8_t utcMinutes, uint8_t* pLocalHours, uint8_t* pLocalMinutes)
+{
+    int8_t localHours = 0;
+    int8_t localMinutes = 0;
+    SSettings* pSettings = settingsGetPointer();
+
+	localHours = utcHours + pSettings->timeZone.hours;
+	if(localHours < 0)
+	{
+		localHours += 24;
+	}
+	if(localHours > 24)
+	{
+		localHours -= 24;
+	}
+	localMinutes = utcMinutes + pSettings->timeZone.minutes;
+	if(localMinutes < 0)
+	{
+		localMinutes += 60;
+	}
+	if(localMinutes > 60)
+	{
+		localMinutes -= 60;
+	}
+	*pLocalHours = localHours;
+	*pLocalMinutes = localMinutes;
+}