See my solution (post 20) for a stop watch:
To make it work when the User leaves the App and returns later, store the current date in milliseconds in a TinyDb, along with the Hrs, Mins, Secs values. Next time the App is opened, subtract the stored milliseconds from the present milliseconds to obtain the time interval the App was closed for. Convert that time interval into Hrs, Mins,Secs and add to the stored values of the same. Add the Hrs, Mins, Secs to the global values of the same. Display these up-to-date values and leave the App to do the rest.