From 2b68cd60669b5cea9bb76ca66ffad26076836311 Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:33:22 -0700 Subject: [PATCH 1/2] Add note about timer behavior --- 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..20d5bfcf9 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. It uses 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 ); From 9a267de01ca883f82f2a429b81b177dff78fb07a Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:43:39 -0700 Subject: [PATCH 2/2] Update source/include/core_mqtt.h Co-authored-by: Archit Gupta --- source/include/core_mqtt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/include/core_mqtt.h b/source/include/core_mqtt.h index 20d5bfcf9..286367211 100644 --- a/source/include/core_mqtt.h +++ b/source/include/core_mqtt.h @@ -72,7 +72,7 @@ struct MQTTDeserializedInfo; * @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. It uses the difference in unsigned numbers is + * 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.