mirror of
https://github.com/espressif/openthread.git
synced 2026-08-03 09:27:47 +00:00
[time-sync] correct the time sync base to radio time (#10825)
The network time offset is computed based on the coprocessor time instead of the host time.
This commit is contained in:
@@ -528,7 +528,8 @@ public:
|
||||
Error ResetCsl(void);
|
||||
#endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE || \
|
||||
OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
/**
|
||||
* Get the current radio time in microseconds referenced to a continuous monotonic local radio clock (64 bits
|
||||
* width).
|
||||
@@ -940,7 +941,8 @@ inline Error Radio::EnableCsl(uint32_t aCslPeriod, otShortAddress aShortAddr, co
|
||||
inline Error Radio::ResetCsl(void) { return otPlatRadioResetCsl(GetInstancePtr()); }
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE || \
|
||||
OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
inline uint64_t Radio::GetNow(void) { return otPlatRadioGetNow(GetInstancePtr()); }
|
||||
|
||||
inline uint8_t Radio::GetCslAccuracy(void) { return otPlatRadioGetCslAccuracy(GetInstancePtr()); }
|
||||
@@ -1050,7 +1052,8 @@ inline Error Radio::EnableCsl(uint32_t, otShortAddress aShortAddr, const otExtAd
|
||||
inline Error Radio::ResetCsl(void) { return kErrorNotImplemented; }
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE || \
|
||||
OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||
inline uint64_t Radio::GetNow(void) { return NumericLimits<uint64_t>::kMax; }
|
||||
|
||||
inline uint8_t Radio::GetCslAccuracy(void) { return NumericLimits<uint8_t>::kMax; }
|
||||
|
||||
@@ -64,7 +64,7 @@ TimeSync::TimeSync(Instance &aInstance)
|
||||
|
||||
TimeSync::Status TimeSync::GetTime(uint64_t &aNetworkTime) const
|
||||
{
|
||||
aNetworkTime = static_cast<uint64_t>(static_cast<int64_t>(otPlatTimeGet()) + mNetworkTimeOffset);
|
||||
aNetworkTime = static_cast<uint64_t>(static_cast<int64_t>(Get<Radio>().GetNow()) + mNetworkTimeOffset);
|
||||
|
||||
return mCurrentStatus;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user