How do you make continuous counter?

How can I make a counter to continue counting even when you sign out of the app, so when you sign in again you see the counter still counting without stop

What do you want count?
when start count, save the time in tiny db.
when re open app, read the time then calculate the time collapsed.

I want an alarm counter to count 1 to 3hours and sound alarm repeatedly and continuously everyday non stop even when I off my phone , when I reopen the phone I will see how many 3 hours that have passed.

App Inventor apps are not really able to run in the background... there are extensions which can help... for your purposes to sound an alarm at a specific time you could try the alarm extension

for the counter follow the suggestion by @Kevinkun
Taifun