# Some problems about millis()

**URL:** https://discourse.processing.org/t/some-problems-about-millis/19530
**Category:** Coding Questions
**Tags:** homework
**Created:** [April 8, 2020, 6:55am UTC](https://discourse.processing.org/t/some-problems-about-millis/19530 "2020-04-08T06:55:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![NKF](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@NKF](https://discourse.processing.org/u/NKF)
#### Post date: [April 8, 2020, 6:55am UTC](https://discourse.processing.org/t/some-problems-about-millis/19530/1 "2020-04-08T06:55:15Z")

</div>

Why I can’t make a 30-second timer with the below codes?

```auto
int time;
int startTime;

void setup()
{
  background(0);
  size(800, 1000);
  time = millis();
  startTime = 30;
  
}

void draw()
{
  fill(250, 255, 8);
  textSize(30);
  text("Time: "+ (startTime - time/1000) + "s", 20, 100);
}

```

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [April 8, 2020, 8:36am UTC](https://discourse.processing.org/t/some-problems-about-millis/19530/2 "2020-04-08T08:36:31Z")

</div>

> [@NKF](#):
>
> text("Time: "+ (startTime - time/1000) + “s”

Instead of time use milis() in this line

> [@NKF](#):
>
> startTime = 30;

In setup this should be startTime=millis()

A timer would be millis() - startTime \> 3000
