# Using millis() to count

**URL:** https://discourse.processing.org/t/using-millis-to-count/3093
**Category:** Coding Questions
**Created:** [August 29, 2018, 12:16pm UTC](https://discourse.processing.org/t/using-millis-to-count/3093 "2018-08-29T12:16:41Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [August 29, 2018, 1:07pm UTC](https://discourse.processing.org/t/using-millis-to-count/3093/2 "2018-08-29T13:07:47Z")

</div>

Maybe check out [Inaccurate time intervals for a Metronome](https://discourse.processing.org/t/inaccurate-time-intervals-for-a-metronome/2463/10?u=neilcsmith) although using `millis()` instead of `System.nanoTime()`. In general, you can’t rely on your code hitting the exact time required. You need to maintain variables with the target times, and trigger events / schedule the next time when that time gets exceeded.

---

_[View the full topic](https://discourse.processing.org/t/using-millis-to-count/3093)._
