From ce8bb2a9761dbdbd77f5dbf31e16c37782446e7f Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:40:06 -0700 Subject: [PATCH] Add note about timer behavior (#279) Description ----------- This PR adds a note about the user provided timer behavior when it overflows. Checklist: ---------- - [NA] I have tested my changes. No regression in existing tests. - [NA] I have modified and/or added unit-tests to cover the code changes in this Pull Request. Related Issue ----------- https://github.com/FreeRTOS/coreMQTT/issues/277 By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- --- source/include/core_mqtt.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/include/core_mqtt.h b/source/include/core_mqtt.h index 1493f3794..286367211 100644 --- a/source/include/core_mqtt.h +++ b/source/include/core_mqtt.h @@ -69,6 +69,14 @@ struct MQTTDeserializedInfo; * @note The timer should be a monotonic timer. It just needs to provide an * incrementing count of milliseconds elapsed since a given epoch. * + * @note As the timer is supposed to be a millisecond timer returning a 32-bit + * value, it will overflow in just under 50 days. But it will not cause any issues + * in the library as the time function is only used for calculating durations for + * timeouts and keep alive periods. The difference in unsigned numbers is + * used where unsigned wrap around is defined. Unless the timeout is bigger than + * 100 days (50*2) where the numbers can wrap around more than once the code + * should work properly. + * * @return The time elapsed in milliseconds. */ typedef uint32_t (* MQTTGetCurrentTimeFunc_t )( void );