aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Backend/Services
diff options
context:
space:
mode:
Diffstat (limited to 'src/Enmarcha.Backend/Services')
-rw-r--r--src/Enmarcha.Backend/Services/Processors/CtagShuttleRealTimeProcessor.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Enmarcha.Backend/Services/Processors/CtagShuttleRealTimeProcessor.cs b/src/Enmarcha.Backend/Services/Processors/CtagShuttleRealTimeProcessor.cs
index 593ac86..570059b 100644
--- a/src/Enmarcha.Backend/Services/Processors/CtagShuttleRealTimeProcessor.cs
+++ b/src/Enmarcha.Backend/Services/Processors/CtagShuttleRealTimeProcessor.cs
@@ -42,7 +42,10 @@ public class CtagShuttleRealTimeProcessor : AbstractRealTimeProcessor
System.Diagnostics.Activity.Current?.SetTag("shuttle.status", status.StatusValue);
// Validate position timestamp - skip if data is stale (>3 minutes old)
- var positionAge = (context.NowLocal - status.LastPositionAt).TotalMinutes;
+ // Convert UTC timestamp to Madrid time for comparison
+ var madridTz = TimeZoneInfo.FindSystemTimeZoneById("Europe/Madrid");
+ var lastPositionMadrid = TimeZoneInfo.ConvertTimeFromUtc(status.LastPositionAt, madridTz);
+ var positionAge = (context.NowLocal - lastPositionMadrid).TotalMinutes;
if (positionAge > MaxPositionAgeMinutes)
{
_logger.LogInformation(