New get_timestamp() API that separates error code and time value #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces #12
The ARM toolchain's time_t is unsigned, so we can't return a negative time_t to indicate an error - it gets casted to a very large positive time.
This commit adds a new overload
which returns 0 on success and a negative value on failure. On success, the time is written to the timestamp variable. This deprecates the old NTPClient::get_timestamp().
Note: The NTPClient is used by cloud connector examples (e.g. mbed-os-example-for-azure), and we have no way to catch NTP errors and retry when using the Arm Compiler due to the error being addressed here. We improved NTP stability by using
time.google.com
, but even that one seems to time out occasionally.