WatchdogTimer.cpp
Go to the documentation of this file.
00001 // WatchdogTimer.cpp
00002 // Copyright (c) SICK AG
00003 // created: 06.06.2011, Willhoeft
00004 
00005 #include "WatchdogTimer.hpp"
00006 #include "Timer.hpp"
00007 
00008 
00014 WatchdogTimer::WatchdogTimer()
00015 {
00016         m_timeoutInterval.m_duration = 0.0;
00017         m_nextElapseTime = Time::now() + m_timeoutInterval;
00018 }
00019 
00020 WatchdogTimer::~WatchdogTimer()
00021 {
00022 }
00023 
00024 
00028 void WatchdogTimer::start(const TimeDuration interval)
00029 {
00030         m_timeoutInterval = interval;
00031         reset();
00032 }
00033 
00037 bool WatchdogTimer::isElapsed()
00038 {
00039         if (Time::now() >= m_nextElapseTime)
00040         {
00041                 // Timer ist abgelaufen
00042                 return true;
00043         }
00044 
00045         // Timer ist noch nicht abgelaufen
00046         return false;
00047 }
00048 
00052 void WatchdogTimer::reset()
00053 {
00054         // Naechste Ablaufzeit setzen
00055         m_nextElapseTime = Time::now() + m_timeoutInterval;
00056 }
00057 


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Wed Jun 14 2017 04:04:50