/* * AlarmTimer.cpp * * Created on: 26 мая 2021 г. * Author: sozonov */ #include "AlarmTimerLogic.hh" void AlarmTimerLogic::stop() { current_state = false; otf_pause = true; } void AlarmTimerLogic::start() { if( not otf_pause ) time_start = clock(); current_state = true; } void AlarmTimerLogic::reset() { time_start = clock(); current_time = 0; current_state= false; otf_alarm = false; otf_pause = false; } void AlarmTimerLogic::process() { if( current_state && not otf_alarm ) { current_time = clock() - time_start; if( current_time >= time_out ) { alarm(); otf_alarm = true; stop(); } } }