From e57c01e42edd833a156bfcbd8a562e920f41890c Mon Sep 17 00:00:00 2001 From: Fesseha Date: Thu, 29 Jun 2023 18:10:24 +0200 Subject: [PATCH] kickout all DST items if they are all in the past --- .../time-synchronization-server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp index c68d1821fc5d55..eb50ab8b7831f0 100644 --- a/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp +++ b/src/app/clusters/time-synchronization-server/time-synchronization-server.cpp @@ -633,12 +633,12 @@ TimeState TimeSynchronizationServer::UpdateDSTOffsetState() } if (!dstList[activeDstIndex].validUntil.IsNull() && dstList[activeDstIndex].validUntil.Value() <= chipEpochTime) { - if (mDstOffsetObj.validSize == 1) // last item in the list + if (activeDstIndex + 1 >= mDstOffsetObj.validSize) // last item in the list { VerifyOrReturnValue(ClearDSTOffset() == CHIP_NO_ERROR, TimeState::kInvalid); return TimeState::kInvalid; } - dstList[activeDstIndex].offset = 0; + dstList[activeDstIndex].offset = 0; // not using dst and last DST item in the list is not active yet return TimeState::kStopped; } if (activeDstIndex > 0)