-
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
Some operations on System::Clock types are not safe #10062
Comments
After a bit of experimentation I think we can use |
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 5, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview What's in this PR #### Testing How was this tested? (at least one bullet point required) * If unit tests were added, how do they cover this issue? * If unit tests existed, how were they fixed/modified to prevent this in future? * If new unit tests are not added, why not? * If integration tests were added, how do they verify this change? * If new integration tests are not added, why not? * If manually tested, what platforms controller and device platforms were manually tested, and how? * If no testing is required, why not?
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 5, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview What's in this PR #### Testing How was this tested? (at least one bullet point required) * If unit tests were added, how do they cover this issue? * If unit tests existed, how were they fixed/modified to prevent this in future? * If new unit tests are not added, why not? * If integration tests were added, how do they verify this change? * If new integration tests are not added, why not? * If manually tested, what platforms controller and device platforms were manually tested, and how? * If no testing is required, why not?
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 12, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview What's in this PR #### Testing How was this tested? (at least one bullet point required) * If unit tests were added, how do they cover this issue? * If unit tests existed, how were they fixed/modified to prevent this in future? * If new unit tests are not added, why not? * If integration tests were added, how do they verify this change? * If new integration tests are not added, why not? * If manually tested, what platforms controller and device platforms were manually tested, and how? * If no testing is required, why not?
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 12, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview What's in this PR #### Testing How was this tested? (at least one bullet point required) * If unit tests were added, how do they cover this issue? * If unit tests existed, how were they fixed/modified to prevent this in future? * If new unit tests are not added, why not? * If integration tests were added, how do they verify this change? * If new integration tests are not added, why not? * If manually tested, what platforms controller and device platforms were manually tested, and how? * If no testing is required, why not?
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 12, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview What's in this PR #### Testing How was this tested? (at least one bullet point required) * If unit tests were added, how do they cover this issue? * If unit tests existed, how were they fixed/modified to prevent this in future? * If new unit tests are not added, why not? * If integration tests were added, how do they verify this change? * If new integration tests are not added, why not? * If manually tested, what platforms controller and device platforms were manually tested, and how? * If no testing is required, why not?
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 12, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview What's in this PR #### Testing How was this tested? (at least one bullet point required) * If unit tests were added, how do they cover this issue? * If unit tests existed, how were they fixed/modified to prevent this in future? * If new unit tests are not added, why not? * If integration tests were added, how do they verify this change? * If new integration tests are not added, why not? * If manually tested, what platforms controller and device platforms were manually tested, and how? * If no testing is required, why not?
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 12, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview What's in this PR #### Testing How was this tested? (at least one bullet point required) * If unit tests were added, how do they cover this issue? * If unit tests existed, how were they fixed/modified to prevent this in future? * If new unit tests are not added, why not? * If integration tests were added, how do they verify this change? * If new integration tests are not added, why not? * If manually tested, what platforms controller and device platforms were manually tested, and how? * If no testing is required, why not?
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 12, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview What's in this PR #### Testing How was this tested? (at least one bullet point required) * If unit tests were added, how do they cover this issue? * If unit tests existed, how were they fixed/modified to prevent this in future? * If new unit tests are not added, why not? * If integration tests were added, how do they verify this change? * If new integration tests are not added, why not? * If manually tested, what platforms controller and device platforms were manually tested, and how? * If no testing is required, why not?
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 15, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview Introduce safe types based on `std::chrono::duration` to `System::Clock`. #### Testing Updated `src/system/tests/TestSystemClock.cpp`
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 15, 2021
#### Problem Issue project-chip#10062 Some operations on System::Clock types are not safe #### Change overview Introduce safe types based on `std::chrono::duration` to `System::Clock`. #### Testing Updated `src/system/tests/TestSystemClock.cpp`
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 15, 2021
#### Problem Issue project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Introduce safe types based on `std::chrono::duration` to `System::Clock`. Future changes will use these types, starting with system timers and proceeding upward through the stack. #### Testing Updated `src/system/tests/TestSystemClock.cpp`
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 18, 2021
#### Problem Timer functions took plain integer arguments and relied 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` times to take `System::Clock::Timeout` instead of plain integers. #### Testing CI; no change to functionality intended.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 18, 2021
#### Problem Timer functions took plain integer arguments and relied 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` times to take `System::Clock::Timeout` instead of plain integers. #### Testing CI; no change to functionality intended.
andy31415
pushed a commit
that referenced
this issue
Oct 21, 2021
* Type-safe System::Clock #### Problem Issue #10062 _Some operations on System::Clock types are not safe_ #### Change overview Introduce safe types based on `std::chrono::duration` to `System::Clock`. Future changes will use these types, starting with system timers and proceeding upward through the stack. #### Testing Updated `src/system/tests/TestSystemClock.cpp` * review
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 21, 2021
#### 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.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 21, 2021
#### 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.
andy31415
pushed a commit
that referenced
this issue
Oct 21, 2021
#### 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` 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.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 21, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Change code under `src/platform`, and immediate callers, to use the safer `System::Clock` types. #### Testing CI; no change to functionality intended.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 21, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Change code under `src/protocols/bdx` to use the safer `Clock` types. #### Testing CI; no change to functionality intended.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 21, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Change `ExchangeContext::Timeout` and affected code. #### Testing CI; no change to functionality intended.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 21, 2021
#### Problem `Event::Timestamp` uses a plain integer for `Type::kSystem`. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Use `System::Clock::Timestamp` instead #### Testing CI; no change to functionality intended.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 22, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Change code under `src/platform`, and immediate callers, to use the safer `System::Clock` types. #### Testing CI; no change to functionality intended.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 22, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Change code under `src/protocols/bdx` to use the safer `Clock` types. #### Testing CI; no change to functionality intended.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 22, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Change code under `src/platform`, and immediate callers, to use the safer `System::Clock` types. #### Testing CI; no change to functionality intended.
woody-apple
pushed a commit
that referenced
this issue
Oct 22, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of #10062 _Some operations on System::Clock types are not safe_ #### Change overview Change code under `src/protocols/bdx` to use the safer `Clock` types. #### Testing CI; no change to functionality intended.
woody-apple
pushed a commit
that referenced
this issue
Oct 23, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of #10062 _Some operations on System::Clock types are not safe_ #### Change overview Change `ExchangeContext::Timeout` and affected code. #### Testing CI; no change to functionality intended.
woody-apple
pushed a commit
that referenced
this issue
Oct 23, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of #10062 _Some operations on System::Clock types are not safe_ #### Change overview Change code under `src/platform`, and immediate callers, to use the safer `System::Clock` types. #### Testing CI; no change to functionality intended.
woody-apple
pushed a commit
that referenced
this issue
Oct 23, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of #10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `examples/chip-tool` to use the safer `Clock` types. #### Testing CI; no change to functionality intended.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 25, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/transport` and `src/messaging` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `src/messaging/tests/echo/echo_requester.cpp` and several `src/transport/raw/tests/`.
woody-apple
pushed a commit
that referenced
this issue
Oct 27, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of #10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/transport` and `src/messaging` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `src/messaging/tests/echo/echo_requester.cpp` and several `src/transport/raw/tests/`.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 27, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/lib/dnssd` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `TestActiveResolveAttempts.cpp`.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 27, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/lib/dnssd` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `TestActiveResolveAttempts.cpp`.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 27, 2021
#### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/lib/dnssd` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `TestActiveResolveAttempts.cpp`.
andy31415
pushed a commit
that referenced
this issue
Oct 27, 2021
* Use safer System::Clock types in dnssd #### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of #10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/lib/dnssd` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `TestActiveResolveAttempts.cpp`. * restyle
JasonLiuZhuoCheng
pushed a commit
to JasonLiuZhuoCheng/connectedhomeip
that referenced
this issue
Oct 28, 2021
…p#10913) #### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/transport` and `src/messaging` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `src/messaging/tests/echo/echo_requester.cpp` and several `src/transport/raw/tests/`.
JasonLiuZhuoCheng
pushed a commit
to JasonLiuZhuoCheng/connectedhomeip
that referenced
this issue
Oct 28, 2021
* Use safer System::Clock types in dnssd #### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/lib/dnssd` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `TestActiveResolveAttempts.cpp`. * restyle
carol-apple
pushed a commit
to carol-apple/connectedhomeip
that referenced
this issue
Oct 28, 2021
* Use safer System::Clock types in dnssd #### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/lib/dnssd` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `TestActiveResolveAttempts.cpp`. * restyle
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 29, 2021
#### Problem Previous PRs added strong types to `System::Clock` and converted many uses, but a few remain. #### Change overview Convert the remaining uses of the weak types (`MonotonicMilliseconds` and `MonotonicMicroseconds`), and remove them from `System::Clock`. Fixes project-chip#10062 Some operations on System::Clock types are not safe There are some remaining uses of `Clock`-derived values as plain integers; these can be found for later cleanup by the use of `.count()`. #### Testing CI; no changes to functionality. Converted `TestPlatformTime`.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 29, 2021
#### Problem Previous PRs added strong types to `System::Clock` and converted many uses, but a few remain. #### Change overview Convert the remaining uses of the weak types (`MonotonicMilliseconds` and `MonotonicMicroseconds`), and remove them from `System::Clock`. Fixes project-chip#10062 Some operations on System::Clock types are not safe There are some remaining uses of `Clock`-derived values as plain integers; these can be found for later cleanup by the use of `.count()`. #### Testing CI; no changes to functionality. Converted `TestPlatformTime`.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 29, 2021
#### Problem Previous PRs added strong types to `System::Clock` and converted many uses, but a few remain. #### Change overview Convert the remaining uses of the weak types (`MonotonicMilliseconds` and `MonotonicMicroseconds`), and remove them from `System::Clock`. Fixes project-chip#10062 Some operations on System::Clock types are not safe There are some remaining uses of `Clock`-derived values as plain integers; these can be found for later cleanup by the use of `.count()`. #### Testing CI; no changes to functionality. Converted `TestPlatformTime`.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Oct 29, 2021
#### Problem Previous PRs added strong types to `System::Clock` and converted many uses, but a few remain. #### Change overview Convert the remaining uses of the weak types (`MonotonicMilliseconds` and `MonotonicMicroseconds`), and remove them from `System::Clock`. Fixes project-chip#10062 Some operations on System::Clock types are not safe There are some remaining uses of `Clock`-derived values as plain integers; these can be found for later cleanup by the use of `.count()`. #### Testing CI; no changes to functionality. Converted `TestPlatformTime`.
andy31415
pushed a commit
that referenced
this issue
Nov 2, 2021
* WIP * Replace and remove weakly-typed System::Clock code #### Problem Previous PRs added strong types to `System::Clock` and converted many uses, but a few remain. #### Change overview Convert the remaining uses of the weak types (`MonotonicMilliseconds` and `MonotonicMicroseconds`), and remove them from `System::Clock`. Fixes #10062 Some operations on System::Clock types are not safe There are some remaining uses of `Clock`-derived values as plain integers; these can be found for later cleanup by the use of `.count()`. #### Testing CI; no changes to functionality. Converted `TestPlatformTime`. * review * initialization consistency * restyle
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Nov 4, 2021
#### Problem `System::TimeSource` still uses raw integer times rather than the safer `Syste::Clock` types based on `std::chrono::duration`. Followup to project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `TimeSource` and its uses. #### Testing CI; no changes to functionality. Converted `TestTimeSource`.
kpschoedel
added a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Nov 4, 2021
#### Problem `System::TimeSource` still uses raw integer times rather than the safer `Syste::Clock` types based on `std::chrono::duration`. Followup to project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `TimeSource` and its uses. #### Testing CI; no changes to functionality. Converted `TestTimeSource`.
woody-apple
pushed a commit
to kpschoedel/connectedhomeip
that referenced
this issue
Nov 4, 2021
#### Problem `System::TimeSource` still uses raw integer times rather than the safer `Syste::Clock` types based on `std::chrono::duration`. Followup to project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `TimeSource` and its uses. #### Testing CI; no changes to functionality. Converted `TestTimeSource`.
andy31415
pushed a commit
that referenced
this issue
Nov 5, 2021
#### Problem `System::TimeSource` still uses raw integer times rather than the safer `Syste::Clock` types based on `std::chrono::duration`. Followup to #10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `TimeSource` and its uses. #### Testing CI; no changes to functionality. Converted `TestTimeSource`.
PSONALl
pushed a commit
to PSONALl/connectedhomeip
that referenced
this issue
Dec 3, 2021
* Use safer System::Clock types in dnssd #### Problem Code uses plain integers to represent time values and relies on users to get the unit scale correct. Part of project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `src/lib/dnssd` to use the safer `Clock` types. #### Testing CI; no change to functionality intended. Conversion includes `TestActiveResolveAttempts.cpp`. * restyle
PSONALl
pushed a commit
to PSONALl/connectedhomeip
that referenced
this issue
Dec 3, 2021
* WIP * Replace and remove weakly-typed System::Clock code #### Problem Previous PRs added strong types to `System::Clock` and converted many uses, but a few remain. #### Change overview Convert the remaining uses of the weak types (`MonotonicMilliseconds` and `MonotonicMicroseconds`), and remove them from `System::Clock`. Fixes project-chip#10062 Some operations on System::Clock types are not safe There are some remaining uses of `Clock`-derived values as plain integers; these can be found for later cleanup by the use of `.count()`. #### Testing CI; no changes to functionality. Converted `TestPlatformTime`. * review * initialization consistency * restyle
PSONALl
pushed a commit
to PSONALl/connectedhomeip
that referenced
this issue
Dec 3, 2021
#### Problem `System::TimeSource` still uses raw integer times rather than the safer `Syste::Clock` types based on `std::chrono::duration`. Followup to project-chip#10062 _Some operations on System::Clock types are not safe_ #### Change overview Convert `TimeSource` and its uses. #### Testing CI; no changes to functionality. Converted `TestTimeSource`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Clock::MonotonicMicroseconds
andClock::MonotonicMilliseconds
are not distinguishable from each other oruint64_t
. (See e.g. PR fix typo in GetCurrentMonotonicTimeMs #10012)Proposed Solution
Make the counts type-safe and provide safe utility functions for the common operations (e.g. ‘is t₁ within δ ms of t₀?’)
The text was updated successfully, but these errors were encountered: