diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-05 18:39:32 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-05-05 18:42:30 +0200 |
commit | fa5efb55fb570b33a842917565592df04d400e94 (patch) | |
tree | 408d1c7bd6d8a93edee4247ce38f923ba2f0693a | |
parent | 8546fc68782d8a82a5c50a49ba1288dcb7714bf9 (diff) |
Avoid returning infinity value.
Change-Id: I89d227e48add0c7fc8a4ca577023995b269e6f13
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r-- | CAN-binder/low-can-binding/utils/timer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/CAN-binder/low-can-binding/utils/timer.cpp b/CAN-binder/low-can-binding/utils/timer.cpp index a35a3e9..17c8665 100644 --- a/CAN-binder/low-can-binding/utils/timer.cpp +++ b/CAN-binder/low-can-binding/utils/timer.cpp @@ -63,7 +63,7 @@ frequency_clock_t::frequency_clock_t(float frequency) /// @param[in] frequency - Frequency to convert, in hertz float frequency_clock_t::frequency_to_period() { - return 1 / frequency_ * unit_; + return frequency_ == 0 ? 0 : 1 / frequency_ * unit_; } bool frequency_clock_t::started() |