Author Topic: Update Timer value  (Read 107 times)

Online Deeps

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
Update Timer value
« on: July 03, 2018, 02:13:12 am »
Hi

I have read this link http://forum.micasaverde.com/index.php?topic=10649.0
and realized that we have no way to cancel previous timer.

but I have following use case and not sure how this can be implemented

function startUp()
   read values/time using get variable, check if variables are set and if set then call timer for that time
   startTimer(time)
end

function startTimer(time)
   call_timer(time)
end


--this function is called from UI
function save(time)
   update saved value of timer
   startTimer(newtime)
end

In my app, user can tell time from UI and actions happen at that time. So from UI save function is called and values get updated in backend.

So my use case is, lets say for the first time if user sets it to 10am, i start timer for 10am and again after some time if user comes back to UI and sets timer to 11am. So in this case.. i want cancel 10am timer and execute only it at 11 am

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10070
  • Karma: +761/-141
Re: Update Timer value
« Reply #1 on: July 09, 2018, 10:30:48 pm »
you can't cancel a timer ... but when the timer happens ... you can add logic to decide if to ignore the timer. (i.e. do nothing and just  return)