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

HAPPlatformTimer API question #102

Open
rojer opened this issue Apr 10, 2021 · 0 comments
Open

HAPPlatformTimer API question #102

rojer opened this issue Apr 10, 2021 · 0 comments

Comments

@rojer
Copy link
Contributor

rojer commented Apr 10, 2021

HAPPlatformTimerRegister specifies duration to be an absolute deadline value, relative to HAPPlatformClockGetCurrent
however, it is sometimes also invoked with 0, which i take it means "ASAP" (1, 2).

this is not documented in API and may trigger bugs in implementations.

rojer added a commit to mongoose-os-libs/homekit-adk that referenced this issue Apr 10, 2021
Turns out, HAPPlatformTimerRegister may be invoked with deadline of 0 sometimes.
This translates into a negative duration for mgos_set_timer, which is fine
for the first 24.85 days but then duration rolls over and things go south.

Instead, clamp negative duration to 0 while it's still a 64-bit int.

apple/HomeKitADK#102

Fixes mongoose-os-apps/shelly-homekit#129
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

No branches or pull requests

1 participant