# Count up timer?

**URL:** <https://community.thunkable.com/t/count-up-timer/380607>\
**Category:** Questions about Thunkable X\
**Created:** [December 24, 2019, 8:27pm UTC](https://community.thunkable.com/t/count-up-timer/380607 "2019-12-24T20:27:45Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 24, 2019, 8:27pm UTC](https://community.thunkable.com/t/count-up-timer/380607/1 "2019-12-24T20:27:45Z")

</div>

I posted this question as part of another about text messages but I want to separate it out.

Can someone share a screenshot of a working count up timer? I’ve looked through the forums and so far haven’t found one from Thunkable X that just displays a timer that counts up each second.

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [December 24, 2019, 10:54pm UTC](https://community.thunkable.com/t/count-up-timer/380607/2 "2019-12-24T22:54:17Z")

</div>

@tatiang . Here’s a simple example:

 ![Screen Shot 2019-12-24 at 2.42.35 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/1/119379cd20b98b7da69dfa6ce0444e5c141068cd.png)

You don’t really need to set the `'Count up'` property via the blocks. You can just set it in the designer. I just put it here for completeness.

Here’s a link to copy the project, if you want: [Thunkable](https://x.thunkable.com/copy/42581239849054a9a0e4d03b3c2e2d5c)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 25, 2019, 12:06am UTC](https://community.thunkable.com/t/count-up-timer/380607/3 "2019-12-25T00:06:38Z")

</div>

Hmm. @Mark, I had the same code. But when I add a Wait 1 second block at the bottom of the forever block, instead of counting up by 1 each second, the timer counts by 500 or more per second. And it’s not even consistent and then it stops at 5000. What’s going on? 🤪

Edit: sorry, you had milliseconds while I had seconds. Now it’s working. How strange. Yay! But… uh… it stops at 5 seconds. Ah, okay, I had to change the interval. Kind of confusing that “interval” is actually the length. I would think of interval as the loop durations (e.g. 1 would be a timer that ticks every 1 second, 15 would be a timer that ticks every 15 seconds).

Here’s the code for a count up timer that ticks off every second (interval set to some high number):

 ![Screen Shot 2019-12-24 at 4.01.57 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/f/5fcfb86f3b108b9b91ed518eb130399a8dfe7f03.png)

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [December 25, 2019, 1:15am UTC](https://community.thunkable.com/t/count-up-timer/380607/4 "2019-12-25T01:15:30Z")

</div>

@tatiang, If you just want to count up seconds you don’t really even need a Timer. Just a loop with a `'Wait 1 seconds'` in it and increment a variable within the loop.

FYI, `'Interval'` **is** the loop duration. Of course you have to set `'Loops'` to be true, otherwise you just get one iteration of the loop, whose duration is, well, `'Duration'`. Also, note that the Timer doesn’t have the notion of ticks, per se. However, you can get the amount of time that the current loop of the time has been running (or remaining, depending on if you are counting up or down), in either seconds or milliseconds.

Hope this helps.

-Mark

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 25, 2019, 4:35am UTC](https://community.thunkable.com/t/count-up-timer/380607/5 "2019-12-25T04:35:36Z")

</div>

I think I was scared off by the recent discussion about how slow Forever blocks were so I avoided the obvious answer: incrementing a variable within a loop. But in practice, it seems fine for the timer I need.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 3, 2020, 4:31pm UTC](https://community.thunkable.com/t/count-up-timer/380607/6 "2020-01-03T16:31:29Z")

</div>

Does a loop with ‘Wait 1 seconds’ actually work? Here’s what I tried and I get a timer that counts by 5 or 6 or 7 or 8 – it’s not consistent – every second.

![Screen Shot 2020-01-03 at 8.17.40 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/6/a6cf92f9d9f6790226aa381182cd5f826f5d3971.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 3, 2020, 10:10pm UTC](https://community.thunkable.com/t/count-up-timer/380607/7 "2020-01-03T22:10:09Z")

</div>

Here’s a fun little timer. Try changing the increment value to a decimal and watch it freak out.

[https://x.thunkable.com/copy/033076d0f0e97867eb2ada3e9d44d9fe](https://x.thunkable.com/copy/033076d0f0e97867eb2ada3e9d44d9fe)

I’ve gotten values like this (in order): 0, 1, 1.5, 2.5, 2.5, 2.5, 2, 3, 3, 3, 3, 3, 3, 3, 3.5, 3, 3, 2.5, 2, null, 2.5, …

The expected values each second should be (in order) 0, 0.5, 1, 1.5, 2, 2.5, 3, etc.

It also seems that the previous increment value (e.g. 0.5) affects the next choice of increment value. That is, if I use 0.5 for each second, I see a certain series of numbers like the bizarre one above. If I then change the increment to something else like 50, I see a new series. Finally, if I change the increment back to the original value of 0.5, the series is much different with values like 0.9, 47, 2, 36, 50, etc., or even long decimals like 104.00000003.

Oh and a Repeat block is even worse than a Forever block. In that case, it increments about 100 each second for an increment value of 0.5.

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [January 4, 2020, 1:35am UTC](https://community.thunkable.com/t/count-up-timer/380607/8 "2020-01-04T01:35:03Z")

</div>

you know, that looks like it _should_ work @tatiang - is there any chance you could just use a timer for this instead rather than waiting and looping like this?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 4, 2020, 2:24am UTC](https://community.thunkable.com/t/count-up-timer/380607/9 "2020-01-04T02:24:32Z")

</div>

Maybe. That’s the route I took after I posted this. But I’m a little disturbed by the fact that a loop block doesn’t behave as I’d expect it to. I tend to base a lot of my app development on predictable math.

Can you explain why the forever+wait 1 second blocks don’t actually do that?

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 4, 2020, 3:18pm UTC](https://community.thunkable.com/t/count-up-timer/380607/10 "2020-01-04T15:18:40Z")

</div>

Try using normal variables and rounding values, which is required for operations with real numbers.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 4, 2020, 4:39pm UTC](https://community.thunkable.com/t/count-up-timer/380607/11 "2020-01-04T16:39:24Z")

</div>

@actech When you say normal variables, you mean “app” variables, right? I’ve done that. That’s what I started with. And I don’t see how rounding would fix this but I did just try that and it still provides unpredictable results.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 5, 2020, 11:54am UTC](https://community.thunkable.com/t/count-up-timer/380607/12 "2020-01-05T11:54:24Z")

</div>

![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/b/2bf069d9a340f2313908aee5126ba45841834bb3.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 5, 2020, 6:25pm UTC](https://community.thunkable.com/t/count-up-timer/380607/13 "2020-01-05T18:25:14Z")

</div>

I wish that worked but I still get unexpected results. I’ll post a video in a minute.

(I had used the Round block but I changed it to “with \_\_ decimal places” after you posted that.)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 5, 2020, 6:33pm UTC](https://community.thunkable.com/t/count-up-timer/380607/14 "2020-01-05T18:33:05Z")

</div>

[https://x.thunkable.com/copy/06d9461757f8da84dc52bebe55d3ced0](https://x.thunkable.com/copy/06d9461757f8da84dc52bebe55d3ced0)

So in this case, the timer is doubled. When IncreaseBy is 1.0, the timer add 2 every second. Easy enough to fix but still not valid for the code I created. And without rounding, it’s just a mess.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 6, 2020, 1:39pm UTC](https://community.thunkable.com/t/count-up-timer/380607/15 "2020-01-06T13:39:08Z")

</div>

If my example does not work for you, it is better to use a different approach. I don’t look at projects that use app-variables.

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [January 7, 2020, 12:02am UTC](https://community.thunkable.com/t/count-up-timer/380607/16 "2020-01-07T00:02:17Z")

</div>

@tatiang There are some weird (and unfortunate) interactions with the `wait` block when you are in the companion and are editing your app. Two things to try would be to kill and restart your companion app after each change and see if you continue to see the issue and also to download and install your app and see if the problem persists. Let us know the results of those experiments.

-Mark

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 7, 2020, 2:58am UTC](https://community.thunkable.com/t/count-up-timer/380607/17 "2020-01-07T02:58:26Z")

</div>

It does seem to work correctly with the code below if I force quit and re-open the Thunkable Live app after I make each change to the “change by” value. But the demo I posted a link to is still doubling the timer value.

![Screen Shot 2020-01-06 at 6.47.55 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/e/def72a04153d080e1757d4cd36b16cf9030ed833.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [January 7, 2020, 4:21am UTC](https://community.thunkable.com/t/count-up-timer/380607/18 "2020-01-07T04:21:03Z")

</div>

@Mark So… my adjustable timer works perfectly when downloaded to my phone. So that’s at least good.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:46am UTC](https://community.thunkable.com/t/count-up-timer/380607/19 "2024-11-08T11:46:08Z")

</div>


