Skip to content
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

Correct/clarify TimerEvent::insert documentation #14005

Merged
merged 1 commit into from
Dec 9, 2020

Conversation

kjbracey
Copy link
Contributor

@kjbracey kjbracey commented Dec 7, 2020

Summary of changes

There was much confusion over the functionality of the original TimerEvent::insert call which was described as "Set relative timestamp of the internal event".

This then extended to my Chrono conversion, meaning the new insert call is not equivalent - it really is relative.

Clarify the original documentation, correct the deprecation messages, and add more notes on conversion.

No functional change, as the new Chrono API makes more sense - it's just different from the old API.

Problem actually spotted when I saw the strange code convert_timestamp was producing for the 32-bit->64-bit timestamp conversion. The caller of it was actually making the mistake of issuing TimerEvent::insert(rel_timeout), meaning they'd also misunderstood the documentation, and were not getting the timeout they expected.

(Chrono would have prevented that mistake as durations and time points are incompatible types).

Impact of changes

Probably not worth putting anything specific in release notes - the insert call was already deprecated (probably should have been double deprecated, given the 64-bit API). Anyone actually using it must have already spotted the issue during conversion. I don't think TimerEvent is used much by apps directly - it's a building block for Timeout and Ticker, which are more commonly used.

Migration actions required

Documentation

None


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[X] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Dec 7, 2020
@ciarmcom ciarmcom requested review from a team December 7, 2020 11:30
@ciarmcom
Copy link
Member

ciarmcom commented Dec 7, 2020

@kjbracey-arm, thank you for your changes.
@ARMmbed/mbed-os-hal @ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

There was much confusion over the functionality of the original
`TimerEvent::insert` call which was described as "Set relative timestamp
of the internal event".

This then extended to my Chrono conversion, meaning the new `insert`
call is not equivalent.

Clarify the original documentation, correct the deprecation messages,
and add more notes on conversion.

No functional change, as the new Chrono API makes more sense - it's just
different from the old API.

Problem actually spotted when I saw the strange code `convert_timestamp`
was producing for the 32-bit->64-bit timestamp conversion. The caller of
it was actually making the mistake of issuing
"TimerEvent::insert(rel_timeout)`, meaning they'd also misunderstood the
documentation, and were not getting the timeout they expected.

(Chrono would have prevented that mistake as durations and time points
are incompatible types).
Copy link
Contributor

@LDong-Arm LDong-Arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the documentation update. I confirm that insert_absolute() was added as an equivalent to insert() to support 64-bit timestamp, see #4094, so both are absolute. I guess "relative" (in that PR) initially meant relative to the current 32-bit cycle, instead of relative to the current time.

It feels to me the non-chrono insert() would've required a proper fix to align with the chrono one, if it weren't deprecated. But as we don't want behaviour changes on something deprecated, this change looks good.

@kjbracey
Copy link
Contributor Author

kjbracey commented Dec 8, 2020

Thanks for finding the history!

Even if the old insert wasn't deprecated, we couldn't change its behaviour without potentially breaking people. We possibly could have added an insert_relative helper alongside it, much as Chrono got anyway.

@LDong-Arm
Copy link
Contributor

@evedon @0xc0170 This should be ready?

@mergify mergify bot added needs: CI and removed needs: review labels Dec 9, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Dec 9, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Dec 9, 2020

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-test ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest ✔️

@0xc0170 0xc0170 merged commit 4c94b4b into ARMmbed:master Dec 9, 2020
@mergify mergify bot removed the ready for merge label Dec 9, 2020
@mbedmain mbedmain added release-version: 6.6.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants