I made a very similar sketch a year ago, although i used Date to save the current time and add some time to it, to know when i could perform an action the next time. (Like taking medicine every 4h or to stop smoking [with increasing intervals])
It worked quite well, while i used it If someones interested, i‘ll try to find the Code, but it’s pretty easy… just convert Date to int and add a value in milliseconds to in/decrease it.
Just had to comment cause the image is sooo similar