From a989208cc6f0796bb2ddc2cf0ad12fd7f4c917d3 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Thu, 28 Nov 2024 21:47:33 +0100 Subject: [PATCH] Simplify DateTimeType handling for OneBusAway Signed-off-by: Jacob Laursen --- .../binding/onebusaway/internal/handler/RouteHandler.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bundles/org.openhab.binding.onebusaway/src/main/java/org/openhab/binding/onebusaway/internal/handler/RouteHandler.java b/bundles/org.openhab.binding.onebusaway/src/main/java/org/openhab/binding/onebusaway/internal/handler/RouteHandler.java index 9ea3d6bce49..2731577286c 100644 --- a/bundles/org.openhab.binding.onebusaway/src/main/java/org/openhab/binding/onebusaway/internal/handler/RouteHandler.java +++ b/bundles/org.openhab.binding.onebusaway/src/main/java/org/openhab/binding/onebusaway/internal/handler/RouteHandler.java @@ -15,8 +15,6 @@ package org.openhab.binding.onebusaway.internal.handler; import static org.openhab.binding.onebusaway.internal.OneBusAwayBindingConstants.*; import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; import java.util.Calendar; import java.util.List; import java.util.Map; @@ -168,8 +166,7 @@ public class RouteHandler extends BaseThingHandler implements RouteDataListener private void publishChannel(ChannelUID channelUID, Calendar now, long lastUpdateTime, List arrivalAndDepartures) { if (channelUID.getId().equals(CHANNEL_ID_UPDATE)) { - updateState(channelUID, new DateTimeType( - ZonedDateTime.ofInstant(Instant.ofEpochMilli(lastUpdateTime), ZoneId.systemDefault()))); + updateState(channelUID, new DateTimeType(Instant.ofEpochMilli(lastUpdateTime))); return; } @@ -201,8 +198,7 @@ public class RouteHandler extends BaseThingHandler implements RouteDataListener logger.debug("Not notifying {} because it is in the past.", channelUID.getId()); continue; } - updateState(channelUID, - new DateTimeType(ZonedDateTime.ofInstant(time.toInstant(), ZoneId.systemDefault()))); + updateState(channelUID, new DateTimeType(time.toInstant())); // Update properties only when we update arrival information. This is not perfect. if (channelUID.getId().equals(CHANNEL_ID_ARRIVAL)) {