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

Use AndroidHighResolutionTimer for elapsed time #425

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

powturns
Copy link
Contributor

This timer uses SystemClock.elapsedRealtimeNanos to calculate the high
resolution timing value, which advances time when the device is asleep.

Fixes a bug introduced by the paho.mqtt.java library when it was changed
to track elapsed time using System.nanoTime. However, on android,
nanoTime does not advance when the device is in a deep sleep. As a
result, pings may not be sent frequently enough, resulting in client
disconnects.

See:
eclipse/paho.mqtt.java#278
eclipse/paho.mqtt.java#774

Signed-off-by: Dustin Thomson dthomson@51systems.com

Please make sure that the following boxes are checked before submitting your Pull Request, thank you!

  • You have signed the Eclipse ECA
  • All of your commits have been signed-off with the correct email address (The same one that you used to sign the CLA)
  • If This PR fixes an issue, that you reference the issue below. OR if this is a new issue that you are fixing straight away that you add some Description about the bug and how this will fix it.
  • If this is new functionality, You have added the appropriate Unit tests.

This timer uses SystemClock.elapsedRealtimeNanos to calculate the high
resolution timing value, which advances time when the device is asleep.

Fixes a bug introduced by the paho.mqtt.java library when it was changed
to track elapsed time using System.nanoTime. However, on android,
nanoTime does not advance when the device is in a deep sleep. As a
result, pings may not be sent frequently enough, resulting in client
disconnects.

See:
eclipse/paho.mqtt.java#278
eclipse/paho.mqtt.java#774

Signed-off-by: Dustin Thomson <dthomson@51systems.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant