-
Notifications
You must be signed in to change notification settings - Fork 3k
Add get/settimeofday retargets #8497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@kegilbert Please take a look at the doxygen issues. |
Likely forgot to mark the return type in the function declaration, will update tomorrow morning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a bit sad to be implementing this when it adds no new functionality - just another name for the second-resolution time()
.
Anyone who is happy with seconds could have trivially changed their code to use time
, and anyone who was hoping for better (as I believe #6988 did) is going to be disappointed by this implementation.
Still, there's scope to improve the implementation later once the API is in (as long as tv_usec always being 0 isn't deemed API).
@kjbracey-arm Thanks for the review! I agree that this doesn't really add a whole lot. I proposed this idea of get/settimeofday essentially acting as a time call with a slightly different format for users expecting get/settimeofday here as it was a rework of Marcus's old implementation using our new timer calls in Mbed OS 5. Usec being 0 is more a byproduct of the RTC implementations at the moment, that can always be updated. |
I'm happy to add the API with second resolution like this, but you will get immediate pushback from users about the low quality of implementation. We will should commit to improve it at some point. In the first pass, could be done without a change to HALs by making the default implementation always use a LPTicker/RTOS count offset added to an initial HAL RTC read, rather than performing an RTC read every time. Have a new I'd favour that approach as I really want Second stage you could add DEVICE_RTC_HIRES for an extended HAL API, for which you go back to calling directly. |
047b1dc
to
0ee471d
Compare
Fyi, this didn't pass the cloud-client-test check.
|
0ee471d
to
670d0dd
Compare
@cmonr Resolved the test failure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff @kegilbert - a few remarks
670d0dd
to
f826b8f
Compare
@kjbracey-arm @donatieng Thanks for the additional feedback! Updated the PR to match the request changes. |
This is ready for another round of reviews! |
f826b8f
to
23cd691
Compare
Apologies for the delay, updated. |
Changes addressed. Please re-review.
Reviewers, when y'all have a chance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @kegilbert !
All the PRs need to be engineering ready (marked as "needs: CI") by the end of the day (Austin time). Otherwise it won't make 5.11 and will need to come in the next release (5.12 for features, 5.11.1 for fixes and new platforms). |
Moved to 5.12, as there are still build failures. Please @kegilbert continue to work on this |
@kegilbert Any Progress? |
Sorry for the delay! Got a bit caught up in release work. @kjbracey-arm Running into an issue were some targets (Odin, Realtek it seems like, potentially others which are pulling in LWIP by default) are including sys/time.h which has a handle for Does this need to be <sys/time.h> or would <time.h> work if we just need it for some struct definitions (was under the impression time.h had the required ones but could be wrong). Also leads to the question on if we could use the toolchain get/setimeofday functions. I was unable to find usable handles in IAR or the Arm compiler but might've missed them hence why I went this route. |
@kjbracey-arm I think @kegilbert is waiting for feedback |
For other POSIX functions we have declared them locally in In this case, if there's type variation in the compiler headers, you may need to have toolchain-conditional - either to make sure you match, or to defer to the compiler header. |
@kegilbert Thoughts? |
Sorry for the late response, still traveling so will be a bit before I can take a closer look but sounds good to me. I'll update this ASAP when I'm back at the beginning of January. |
389f691
to
2485b3a
Compare
@cmonr Changed the function declaration to match the conflicting one. Seems to run alright now. |
CI started |
Test run: FAILEDSummary: 1 of 7 test jobs failed Failed test jobs:
|
2485b3a
to
dafb01c
Compare
Didn't realize ARMC6 doesn't set the |
restart CI |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
In reference to: #6988
Move the Time function implementation to get/settimeofday to match the stdlib calls and have the Time API call into the new functions.
Questions/Comments:
Test code:
Pull request type