Skip to content

Commit

Permalink
Add note about timer behavior (#279)
Browse files Browse the repository at this point in the history
Description
-----------
This PR adds a note about the user provided timer behavior when it
overflows.

Checklist:
----------
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [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
-----------
#277

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------
  • Loading branch information
AniruddhaKanhere authored Apr 11, 2024
1 parent 9a3edb6 commit ce8bb2a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/include/core_mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit ce8bb2a

Please sign in to comment.