From 2d01950ac284b22a8560ae8c63898fe6d813881d Mon Sep 17 00:00:00 2001 From: Tao Yang Date: Fri, 12 Aug 2022 12:01:00 +0800 Subject: [PATCH] [BEKEN] change the return type of InitClock_RealTime() and update some comments. --- src/platform/Beken/SystemTimeSupport.cpp | 9 ++++++-- src/platform/Beken/matter_pal.h | 26 ++++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/platform/Beken/SystemTimeSupport.cpp b/src/platform/Beken/SystemTimeSupport.cpp index 1cacab2b0a6336..46a0fe5095a648 100644 --- a/src/platform/Beken/SystemTimeSupport.cpp +++ b/src/platform/Beken/SystemTimeSupport.cpp @@ -20,7 +20,7 @@ /** * @file * Provides implementations of the CHIP System Layer platform - * time/clock functions that are suitable for use on the Ameba platform. + * time/clock functions that are suitable for use on the Beken platform. */ /* this file behaves like a config.h, comes first */ #include @@ -73,7 +73,12 @@ CHIP_ERROR InitClock_RealTime() baseTime = Clock::Milliseconds64((static_cast(CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD) * kMicrosecondsPerMillisecond)); - return CHIP_NO_ERROR; + // Use CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD as the initial value of RealTime. + // Then the RealTime obtained from GetClock_RealTime will be always valid. + // + // TODO(19081): This is broken because it causes the platform to report + // that it does have wall clock time when it actually doesn't. + return System::SystemClock().SetClock_RealTime(baseTime); } } // namespace Clock diff --git a/src/platform/Beken/matter_pal.h b/src/platform/Beken/matter_pal.h index 45b6ab36a81ebd..40ce28cba8d66b 100644 --- a/src/platform/Beken/matter_pal.h +++ b/src/platform/Beken/matter_pal.h @@ -1,13 +1,23 @@ -/** - **************************************************************************************** +/* + * + * Copyright (c) 2022 Project CHIP Authors * - * @file matter_pal.h + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * @brief This file contains matter_pal. - * @author zhengyaohan - * @date 2022-03-29 + * http://www.apache.org/licenses/LICENSE-2.0 * - **************************************************************************************** + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file contains matter_pal. */ #ifndef _MATTER_PAL_H_ @@ -34,5 +44,5 @@ #include "at_ble_common.h" #include "ble.h" -#endif // _HOMEKIT_PAL_H_ +#endif // _MATTER_PAL_H_ // eof