# Some questions about millis()

**URL:** <https://discourse.processing.org/t/some-questions-about-millis/19541>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [April 8, 2020, 2:17pm UTC](https://discourse.processing.org/t/some-questions-about-millis/19541 "2020-04-08T14:17:41Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [April 8, 2020, 8:11pm UTC](https://discourse.processing.org/t/some-questions-about-millis/19541/3 "2020-04-08T20:11:48Z")

</div>

Hello,

You can’t reset millis().  
You can start a time elapsed counter that counts from the time started.

A simple example:

```auto
int timeStart;
int timeElapsed;

void setup() 
  {
  timeStart = millis();
  }

void draw() 
  {
  timeElapsed = millis() - timeStart;
  println(timeElapsed);
  }

void keyPressed()
  {
  timeStart = millis(); //Resets time elapsed counter
  }

```

`:)`

Other millis() examples here:

> **[25 life-saving tips for Processing](https://amnonp5.wordpress.com/2012/01/28/25-life-saving-tips-for-processing/)**
>
> I have bundled a huge number and variety of code examples in this single mega-post. Please learn from my mistakes and experiences! ;-)

---

_[View the full topic](https://discourse.processing.org/t/some-questions-about-millis/19541)._
