-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 safe System::Clock types for system timers #10779
Use safe System::Clock types for system timers #10779
Conversation
#### Problem Timer functions take plain integer arguments and rely on callers to get the units correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Change `System::Layer` and `PlatformManager` timers to take `System::Clock::Timeout` instead of plain integers. This change primarily converts arguments at call sites by wrapping with a `Clock::Milliseconds32()` constructor or similar operation. Future changes will convert types further up the call stack. #### Testing CI; no change to functionality intended.
PR #10779: Size comparison from 288d42a to bc64f81 Increases (8 builds for linux)
Decreases (11 builds for efr32, mbed, p6, qpg, telink)
Full report (19 builds for efr32, linux, mbed, p6, qpg, telink)
|
PR #10779: Size comparison from 288d42a to bc64f81 Increases (8 builds for linux)
Decreases (9 builds for efr32, p6, qpg, telink)
Full report (17 builds for efr32, linux, p6, qpg, telink)
|
PR #10779: Size comparison from 288d42a to bc64f81 15 builds (for efr32, k32w, linux)
12 builds (for esp32, nrfconnect)
|
Fast track rationale: code refactoring adding an explicit cast - trivial refactoring. @kpschoedel - merge conflicts before this can be merged. |
PR #10779: Size comparison from 1b9ac5f to 607c4d8 8 builds (for k32w, p6, qpg, telink)
14 builds (for efr32, linux, mbed)
12 builds (for esp32, nrfconnect)
|
Size increase report for "gn_qpg-example-build" from 1b9ac5f
Full report output
|
Size increase report for "esp32-example-build" from 1b9ac5f
Full report output
|
Size increase report for "nrfconnect-example-build" from 1b9ac5f
Full report output
|
Problem
Timer functions take plain integer arguments and rely on callers to
get the units correct.
Part of #10062 Some operations on System::Clock types are not safe
Change overview
Change
System::Layer
andPlatformManager
timers to takeSystem::Clock::Timeout
instead of plain integers.This change primarily converts arguments at call sites by wrapping
with a
Clock::Milliseconds32()
constructor or similar operation.Future changes will convert types further up the call stack.
Also removed
IsEarlier()
andAddOffset()
in favour of ‘<’ and ‘+’, given the 64/32-bit non-overflow guarantee introduced in commit 0fd7520.Testing
CI; no change to functionality intended.