# How to make a timer in Processing?

**URL:** <https://discourse.processing.org/t/how-to-make-a-timer-in-processing/20481>\
**Category:** Coding Questions\
**Created:** [May 4, 2020, 11:08pm UTC](https://discourse.processing.org/t/how-to-make-a-timer-in-processing/20481 "2020-05-04T23:08:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 4, 2020, 11:15pm UTC](https://discourse.processing.org/t/how-to-make-a-timer-in-processing/20481/2 "2020-05-04T23:15:00Z")

</div>

> [@Cybernet](#):
>
> Now I considered using `millis()` however I can’t figure out how it make it start when the game starts.

millis() started counting as soon as you started your sketch.

> **[millis() / Reference](https://processing.org/reference/millis_.html)**
>
> Returns the number of milliseconds (thousandths of a second) since starting the sketch. This information is often used for timing animation sequences.

An example here:

> [@Some questions about millis()](https://discourse.processing.org/t/some-questions-about-millis/19541/3):
>
> Hello, You can’t reset millis(). You can start a time elapsed counter that counts from the time started. A simple example: int timeStart; int timeElapsed; void setup() { timeStart = millis(); } void draw() { timeElapsed = millis() - timeStart; println(timeElapsed); } void keyPressed() { timeStart = millis(); //Resets time elapsed counter }slight_smile Other millis() examples here:

`:)`

---

_[View the full topic](https://discourse.processing.org/t/how-to-make-a-timer-in-processing/20481)._
