In my app I want measure the amount of time that the accelerometer is at rest. 

For example, if I set a threshold of 0.4 m/s and the accelerometer speed is always below this than it means that the phone is at rest (threshold is to account for jitter in values). 

I want to be able to count the amount of time that the phone is at rest and upon reaching a certain amount of time at rest, then react to that event. 

I already have the accelerometer working fine, I just need to count this time and I'm unfamiliar with how to do this, can anyone help me out here? Thanks in advance 

**Solution:**

```
  start = System.currentTimeMillis();

    if (vectorTotal > 10.1 || vectorTotal < 9.5){
        timelimit = (System.currentTimeMillis()+ 10000);
    }
    else if (start >= timelimit){
        checkUser();
        timelimit = (System.currentTimeMillis()+ 10000);
    }

```