diff --git a/config/python/CHIPProjectConfig.h b/config/python/CHIPProjectConfig.h index a1a01f4546e354..7282f35db3a033 100644 --- a/config/python/CHIPProjectConfig.h +++ b/config/python/CHIPProjectConfig.h @@ -25,8 +25,6 @@ #define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 1 -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - #define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2 #define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1 diff --git a/config/standalone/CHIPProjectConfig.h b/config/standalone/CHIPProjectConfig.h index dcfd2a526d9757..f9a8a80026d852 100644 --- a/config/standalone/CHIPProjectConfig.h +++ b/config/standalone/CHIPProjectConfig.h @@ -26,8 +26,6 @@ #define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 1 -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - #define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2 #define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1 diff --git a/examples/all-clusters-app/p6/include/CHIPProjectConfig.h b/examples/all-clusters-app/p6/include/CHIPProjectConfig.h index e65a1726302940..7a6ada1013b678 100644 --- a/examples/all-clusters-app/p6/include/CHIPProjectConfig.h +++ b/examples/all-clusters-app/p6/include/CHIPProjectConfig.h @@ -90,13 +90,6 @@ */ #define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/chip-tool/include/CHIPProjectAppConfig.h b/examples/chip-tool/include/CHIPProjectAppConfig.h index 2a0d8162651b7f..72a5e43927a75d 100644 --- a/examples/chip-tool/include/CHIPProjectAppConfig.h +++ b/examples/chip-tool/include/CHIPProjectAppConfig.h @@ -25,8 +25,6 @@ #define CHIP_CONFIG_ENABLE_EPHEMERAL_UDP_PORT 1 -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - #define CHIP_CONFIG_EVENT_LOGGING_NUM_EXTERNAL_CALLBACKS 2 #define CHIP_CONFIG_EVENT_LOGGING_EXTERNAL_EVENT_SUPPORT 1 diff --git a/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index cfe5e01821d26f..b1087741ca6958 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lighting-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -132,13 +132,6 @@ */ #define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h b/examples/lock-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h index d75d443d08b867..d422b6cd6219d8 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h +++ b/examples/lock-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h @@ -105,13 +105,6 @@ */ //#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h index 8d78fff3ec7101..620662f80ca98a 100644 --- a/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/lock-app/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -132,13 +132,6 @@ */ #define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/lock-app/p6/include/CHIPProjectConfig.h b/examples/lock-app/p6/include/CHIPProjectConfig.h index 26846f111f5df5..94246045e8aa41 100644 --- a/examples/lock-app/p6/include/CHIPProjectConfig.h +++ b/examples/lock-app/p6/include/CHIPProjectConfig.h @@ -86,13 +86,6 @@ */ #define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/include/CHIPProjectConfig.h b/examples/persistent-storage/cc13x2x7_26x2x7/include/CHIPProjectConfig.h index 30b3f64031b237..27f3ee9a0268ec 100644 --- a/examples/persistent-storage/cc13x2x7_26x2x7/include/CHIPProjectConfig.h +++ b/examples/persistent-storage/cc13x2x7_26x2x7/include/CHIPProjectConfig.h @@ -117,13 +117,6 @@ */ //#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/platform/qpg/project_include/CHIPProjectConfig.h b/examples/platform/qpg/project_include/CHIPProjectConfig.h index 14af702b22c159..86fda64698b92c 100644 --- a/examples/platform/qpg/project_include/CHIPProjectConfig.h +++ b/examples/platform/qpg/project_include/CHIPProjectConfig.h @@ -101,13 +101,6 @@ */ #define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h b/examples/pump-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h index 3ac87262d50bca..074e0401ab222f 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h +++ b/examples/pump-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h @@ -109,13 +109,6 @@ */ //#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h b/examples/pump-controller-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h index 3ac87262d50bca..074e0401ab222f 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/include/CHIPProjectConfig.h @@ -109,13 +109,6 @@ */ //#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1 -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/examples/shell/nxp/k32w/k32w0/include/CHIPProjectConfig.h b/examples/shell/nxp/k32w/k32w0/include/CHIPProjectConfig.h index af06d88a9a0877..3308b4598a01d8 100644 --- a/examples/shell/nxp/k32w/k32w0/include/CHIPProjectConfig.h +++ b/examples/shell/nxp/k32w/k32w0/include/CHIPProjectConfig.h @@ -132,13 +132,6 @@ */ #define CHIP_CONFIG_EVENT_LOGGING_WDM_OFFLOAD 1 -/** - * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS - * - * Enable recording UTC timestamps. - */ -#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 0 - /** * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE * diff --git a/src/app/EventLoggingTypes.h b/src/app/EventLoggingTypes.h index 09f7e996f471ff..de143ec50c3ba8 100644 --- a/src/app/EventLoggingTypes.h +++ b/src/app/EventLoggingTypes.h @@ -117,9 +117,9 @@ struct Timestamp Timestamp(Type aType) : mType(aType) { mValue = 0; } Timestamp(Type aType, uint64_t aValue) : mType(aType), mValue(aValue) {} Timestamp(System::Clock::Timestamp aValue) : mType(Type::kSystem), mValue(aValue.count()) {} - static Timestamp Epoch(uint64_t aValue) + static Timestamp Epoch(System::Clock::Timestamp aValue) { - Timestamp timestamp(Type::kEpoch, aValue); + Timestamp timestamp(Type::kEpoch, aValue.count()); return timestamp; } static Timestamp System(System::Clock::Timestamp aValue) diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index 2df2526777d2f5..d14e5a3b247b90 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -90,7 +90,7 @@ struct EventEnvelopeContext #if CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS & CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME Timestamp mDeltaTime = Timestamp::System(System::Clock::kZero); #else - Timestamp mDeltaTime = Timestamp::Epoch(0); + Timestamp mDeltaTime = Timestamp::Epoch(System::Clock::kZero); #endif PriorityLevel mPriority = PriorityLevel::First; NodeId mNodeId = 0; @@ -521,10 +521,10 @@ CHIP_ERROR EventManagement::LogEventPrivate(EventLoggingDelegate * apDelegate, E CircularEventBuffer * buffer = nullptr; EventLoadOutContext ctxt = EventLoadOutContext(writer, aEventOptions.mpEventSchema->mPriority, GetPriorityBuffer(aEventOptions.mpEventSchema->mPriority)->GetLastEventNumber()); - + EventOptions opts; #if CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS & CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME Timestamp timestamp; - uint64_t utc_time; + System::Clock::Timestamp utc_time; err = System::SystemClock().GetClock_RealTimeMS(utc_time); SuccessOrExit(err); @@ -533,7 +533,7 @@ CHIP_ERROR EventManagement::LogEventPrivate(EventLoggingDelegate * apDelegate, E Timestamp timestamp(System::SystemClock().GetMonotonicTimestamp()); #endif - EventOptions opts = EventOptions(timestamp); + opts = EventOptions(timestamp); // Start the event container (anonymous structure) in the circular buffer writer.Init(*mpEventBuffer); @@ -885,8 +885,8 @@ void CircularEventBuffer::Init(uint8_t * apBuffer, uint32_t aBufferLength, Circu mFirstEventNumber = 1; mLastEventNumber = 0; #if CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS & CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME - mFirstEventTimestamp = Timestamp::Epoch(0); - mLastEventTimestamp = Timestamp::Epoch(0); + mFirstEventTimestamp = Timestamp::Epoch(System::Clock::kZero); + mLastEventTimestamp = Timestamp::Epoch(System::Clock::kZero); #else mFirstEventTimestamp = Timestamp::System(System::Clock::kZero); mLastEventTimestamp = Timestamp::System(System::Clock::kZero); diff --git a/src/platform/ESP32/SystemTimeSupport.cpp b/src/platform/ESP32/SystemTimeSupport.cpp index 4e9afad2a79fef..d802ea8ed4d389 100644 --- a/src/platform/ESP32/SystemTimeSupport.cpp +++ b/src/platform/ESP32/SystemTimeSupport.cpp @@ -48,7 +48,7 @@ Milliseconds64 ClockImpl::GetMonotonicMilliseconds64(void) return std::chrono::duration_cast(GetMonotonicMicroseconds64()); } -CHIP_ERROR ClockImpl::GetClock_RealTime(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTime(Clock::Microseconds64 & aCurTime) { struct timeval tv; if (gettimeofday(&tv, nullptr) != 0) @@ -64,11 +64,11 @@ CHIP_ERROR ClockImpl::GetClock_RealTime(uint64_t & aCurTime) return CHIP_ERROR_REAL_TIME_NOT_SYNCED; } static_assert(CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD >= 0, "We might be letting through negative tv_sec values!"); - aCurTime = (static_cast(tv.tv_sec) * UINT64_C(1000000)) + static_cast(tv.tv_usec); + aCurTime = Clock::Microseconds64((static_cast(tv.tv_sec) * UINT64_C(1000000)) + static_cast(tv.tv_usec)); return CHIP_NO_ERROR; } -CHIP_ERROR ClockImpl::GetClock_RealTimeMS(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Clock::Milliseconds64 & aCurTime) { struct timeval tv; if (gettimeofday(&tv, nullptr) != 0) @@ -84,15 +84,16 @@ CHIP_ERROR ClockImpl::GetClock_RealTimeMS(uint64_t & aCurTime) return CHIP_ERROR_REAL_TIME_NOT_SYNCED; } static_assert(CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD >= 0, "We might be letting through negative tv_sec values!"); - aCurTime = (static_cast(tv.tv_sec) * UINT64_C(1000)) + (static_cast(tv.tv_usec) / 1000); + aCurTime = + Clock::Milliseconds64((static_cast(tv.tv_sec) * UINT64_C(1000)) + (static_cast(tv.tv_usec) / 1000)); return CHIP_NO_ERROR; } -CHIP_ERROR ClockImpl::SetClock_RealTime(uint64_t aNewCurTime) +CHIP_ERROR ClockImpl::SetClock_RealTime(Clock::Microseconds64 aNewCurTime) { struct timeval tv; - tv.tv_sec = static_cast(aNewCurTime / UINT64_C(1000000)); - tv.tv_usec = static_cast(aNewCurTime % UINT64_C(1000000)); + tv.tv_sec = static_cast(aNewCurTime.count() / UINT64_C(1000000)); + tv.tv_usec = static_cast(aNewCurTime.count() % UINT64_C(1000000)); if (settimeofday(&tv, nullptr) != 0) { return (errno == EPERM) ? CHIP_ERROR_ACCESS_DENIED : CHIP_ERROR_POSIX(errno); diff --git a/src/platform/FreeRTOS/SystemTimeSupport.cpp b/src/platform/FreeRTOS/SystemTimeSupport.cpp index ca05a713696ff5..bd6e9acca497f6 100644 --- a/src/platform/FreeRTOS/SystemTimeSupport.cpp +++ b/src/platform/FreeRTOS/SystemTimeSupport.cpp @@ -102,32 +102,47 @@ Clock::Milliseconds64 ClockImpl::GetMonotonicMilliseconds64(void) return Clock::Milliseconds64((FreeRTOSTicksSinceBoot() * kMillisecondsPerSecond) / configTICK_RATE_HZ); } -Error ClockImpl::GetClock_RealTime(uint64_t & aCurTime) +uint64_t GetClock_Monotonic(void) +{ + return (FreeRTOSTicksSinceBoot() * kMicrosecondsPerSecond) / configTICK_RATE_HZ; +} + +uint64_t GetClock_MonotonicMS(void) +{ + return (FreeRTOSTicksSinceBoot() * kMillisecondsPerSecond) / configTICK_RATE_HZ; +} + +uint64_t GetClock_MonotonicHiRes(void) +{ + return GetClock_Monotonic(); +} + +CHIP_ERROR ClockImpl::GetClock_RealTime(Clock::Microseconds64 & aCurTime) { if (sBootTimeUS == 0) { return CHIP_ERROR_REAL_TIME_NOT_SYNCED; } - aCurTime = sBootTimeUS + GetClock_Monotonic(); + aCurTime = Clock::Microseconds64(sBootTimeUS + GetClock_Monotonic()); return CHIP_NO_ERROR; } -Error ClockImpl::GetClock_RealTimeMS(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Clock::Milliseconds64 & aCurTime) { if (sBootTimeUS == 0) { return CHIP_ERROR_REAL_TIME_NOT_SYNCED; } - aCurTime = (sBootTimeUS + GetClock_Monotonic()) / 1000; + aCurTime = Clock::Milliseconds64((sBootTimeUS + GetClock_Monotonic()) / 1000); return CHIP_NO_ERROR; } -Error ClockImpl::SetClock_RealTime(uint64_t aNewCurTime) +CHIP_ERROR ClockImpl::SetClock_RealTime(Clock::Microseconds64 aNewCurTime) { uint64_t timeSinceBootUS = GetClock_Monotonic(); - if (newCurTime > timeSinceBootUS) + if (aNewCurTime.count() > timeSinceBootUS) { - sBootTimeUS = aNewCurTime - timeSinceBootUS; + sBootTimeUS = aNewCurTime.count() - timeSinceBootUS; } else { diff --git a/src/platform/Linux/SystemTimeSupport.cpp b/src/platform/Linux/SystemTimeSupport.cpp index 895dfe97800404..a4b5ec0b75229a 100644 --- a/src/platform/Linux/SystemTimeSupport.cpp +++ b/src/platform/Linux/SystemTimeSupport.cpp @@ -50,17 +50,17 @@ Milliseconds64 ClockImpl::GetMonotonicMilliseconds64() return std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()); } -CHIP_ERROR ClockImpl::GetClock_RealTime(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTime(Clock::Microseconds64 & aCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -CHIP_ERROR ClockImpl::GetClock_RealTimeMS(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Clock::Milliseconds64 & aCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -CHIP_ERROR ClockImpl::SetClock_RealTime(uint64_t aNewCurTime) +CHIP_ERROR ClockImpl::SetClock_RealTime(Clock::Microseconds64 aNewCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } diff --git a/src/platform/Zephyr/SystemTimeSupport.cpp b/src/platform/Zephyr/SystemTimeSupport.cpp index 0eacdb7b2ce364..eb57d9476e753f 100644 --- a/src/platform/Zephyr/SystemTimeSupport.cpp +++ b/src/platform/Zephyr/SystemTimeSupport.cpp @@ -48,6 +48,21 @@ Milliseconds64 ClockImpl::GetMonotonicMilliseconds64(void) return Milliseconds64(k_uptime_get()); } +CHIP_ERROR ClockImpl::GetClock_RealTime(Clock::Microseconds64 & aCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Clock::Milliseconds64 & aCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR ClockImpl::SetClock_RealTime(Clock::Microseconds64 aNewCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + } // namespace Clock } // namespace System } // namespace chip diff --git a/src/platform/mbed/SystemTimeSupport.cpp b/src/platform/mbed/SystemTimeSupport.cpp index 1f4311eaebf74e..dbf84c4a437c96 100644 --- a/src/platform/mbed/SystemTimeSupport.cpp +++ b/src/platform/mbed/SystemTimeSupport.cpp @@ -71,6 +71,21 @@ Milliseconds64 ClockImpl::GetMonotonicMilliseconds64() return std::chrono::duration_cast(GetMonotonicMicroseconds64()); } +CHIP_ERROR ClockImpl::GetClock_RealTime(Clock::Microseconds64 & aCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Clock::Milliseconds64 & aCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR ClockImpl::SetClock_RealTime(Clock::Microseconds64 aNewCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + } // namespace Clock } // namespace System } // namespace chip diff --git a/src/system/SystemClock.cpp b/src/system/SystemClock.cpp index 175f235836084d..c52a1ecec0ed03 100644 --- a/src/system/SystemClock.cpp +++ b/src/system/SystemClock.cpp @@ -82,17 +82,17 @@ ClockBase * gClockBase = &gClockImpl; #define MONOTONIC_CLOCK_ID CLOCK_MONOTONIC #endif -CHIP_ERROR ClockImpl::GetClock_RealTime(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTime(Microseconds64 & aCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -CHIP_ERROR ClockImpl::GetClock_RealTimeMS(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Milliseconds64 & aCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -CHIP_ERROR ClockImpl::SetClock_RealTime(uint64_t aNewCurTime) +CHIP_ERROR ClockImpl::SetClock_RealTime(Microseconds64 aNewCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } @@ -115,6 +115,21 @@ Milliseconds64 ClockImpl::GetMonotonicMilliseconds64() #if HAVE_GETTIMEOFDAY +CHIP_ERROR ClockImpl::GetClock_RealTime(Microseconds64 & aCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Milliseconds64 & aCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + +CHIP_ERROR ClockImpl::SetClock_RealTime(Microseconds64 aNewCurTime) +{ + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; +} + Microseconds64 ClockImpl::GetMonotonicMicroseconds64() { struct timeval tv; @@ -136,27 +151,27 @@ Milliseconds64 ClockImpl::GetMonotonicMilliseconds64() // -------------------- Default Get/SetClock Functions for LwIP Systems -------------------- -CHIP_ERROR ClockImpl::GetClock_RealTime(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTime(Microseconds64 & aCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -CHIP_ERROR ClockImpl::GetClock_RealTimeMS(uint64_t & aCurTime) +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Milliseconds64 & aCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -CHIP_ERROR ClockImpl::SetClock_RealTime(uint64_t aNewCurTime) +CHIP_ERROR ClockImpl::SetClock_RealTime(Microseconds64 aNewCurTime) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } -Microseconds64 ClockImpl::GetMonotonicMicroseconds64(void) +Microseconds64 ClockImpl::GetMonotonicMicroseconds64() { return GetMonotonicMilliseconds64(); } -Milliseconds64 ClockImpl::GetMonotonicMilliseconds64(void) +Milliseconds64 ClockImpl::GetMonotonicMilliseconds64() { static volatile uint64_t overflow = 0; static volatile u32_t lastSample = 0; diff --git a/src/system/SystemClock.h b/src/system/SystemClock.h index 5c447e772d423b..a65941ef2dbe69 100644 --- a/src/system/SystemClock.h +++ b/src/system/SystemClock.h @@ -217,7 +217,7 @@ class ClockBase * @retval #CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE * If the platform is incapable of tracking real time. */ - virtual CHIP_ERROR GetClock_RealTime(uint64_t & aCurTime) = 0; + virtual CHIP_ERROR GetClock_RealTime(Microseconds64 & aCurTime) = 0; /** * @brief @@ -242,7 +242,7 @@ class ClockBase * @retval #CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE * If the platform is incapable of tracking real time. */ - virtual CHIP_ERROR GetClock_RealTimeMS(uint64_t & aCurTime) = 0; + virtual CHIP_ERROR GetClock_RealTimeMS(Milliseconds64 & aCurTime) = 0; /** * @brief @@ -278,7 +278,7 @@ class ClockBase * If the calling application does not have the privilege to set the * current time. */ - virtual CHIP_ERROR SetClock_RealTime(uint64_t aNewCurTime) = 0; + virtual CHIP_ERROR SetClock_RealTime(Microseconds64 aNewCurTime) = 0; }; // Currently we have a single implementation class, ClockImpl, whose members are implemented in build-specific files. @@ -288,9 +288,9 @@ class ClockImpl : public ClockBase ~ClockImpl() = default; Microseconds64 GetMonotonicMicroseconds64() override; Milliseconds64 GetMonotonicMilliseconds64() override; - CHIP_ERROR GetClock_RealTime(uint64_t & aCurTime) override; - CHIP_ERROR GetClock_RealTimeMS(uint64_t & aCurTime) override; - CHIP_ERROR SetClock_RealTime(uint64_t aNewCurTime) override; + CHIP_ERROR GetClock_RealTime(Microseconds64 & aCurTime) override; + CHIP_ERROR GetClock_RealTimeMS(Milliseconds64 & aCurTime) override; + CHIP_ERROR SetClock_RealTime(Microseconds64 aNewCurTime) override; }; namespace Internal {