summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/utils/timer.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-05 18:39:32 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-05 18:42:30 +0200
commitfa5efb55fb570b33a842917565592df04d400e94 (patch)
tree408d1c7bd6d8a93edee4247ce38f923ba2f0693a /CAN-binder/low-can-binding/utils/timer.cpp
parent8546fc68782d8a82a5c50a49ba1288dcb7714bf9 (diff)
Avoid returning infinity value.
Change-Id: I89d227e48add0c7fc8a4ca577023995b269e6f13 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/utils/timer.cpp')
-rw-r--r--CAN-binder/low-can-binding/utils/timer.cpp2
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 a35a3e9f..17c86659 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()