Including Time with X Value

I have no experience with time or timers in coding, in fact this is my first project ever. In my project, the goal is to have an accelerometer detect positioning and notify the user when they need to readjust their orientation. By using a circuit playground bluefruit, and a haptic motor, the user can wear the device in their shirt. when the accelerometer reads a value indicating the user is inverted the motor will vibrate. But I need the motor to vibrate if and only if the user is inverted for a certain amount of time. I tried to write the "timers" code, but am lost, confused, and need help. Thank you for taking the time to read my post.

In short: if y > -8 for 10 minutes, drive motor. unless y =< -8 do nothing

FULL CODE:

#include <bluefruit.h>
#include <Adafruit_CircuitPlayground.h>
#include <Wire.h> //connects arduino library i2c
#include "Adafruit_DRV2605.h" //allows you to include the adafruit haptic driver library
Adafruit_DRV2605 drv; //sets the i2c adress to communicate to arduino

float X, Y, Z;
const int interval = 10000;

void setup() {
Serial.begin(9600);
CircuitPlayground.begin();
}

void loop() {
X = CircuitPlayground.motionX();
Y = CircuitPlayground.motionY();
Z = CircuitPlayground.motionZ();

Serial.print("X: ");
Serial.print(X);
Serial.print(" Y: ");
Serial.print(Y);
Serial.print(" Z: ");
Serial.println(Z);
delay(1000);

if ((CircuitPlayground.motionY() < -8 )){
Serial.print ("Inverted");
int startMillis = millis(); // reset the clock

if (millis() - startMillis >= interval) {
Serial.println("Motor");
drv.setWaveform(0, 47);
drv.setWaveform(1, 0);
drv.go(); //gets the vibration motor going22
}
}
}

collinpagel:
In short: if y > -8 for 10 minutes, drive motor. unless y =< -8 do nothing
[...]
const int interval = 10000;

10 minutes, or 10 seconds?

It will be 10 minutes when the product is complete.

As of right now I am testing with 10 seconds in mind as to no have to wait that long

i suggest you think somewhat differently.

instead of checking time while the condition is true, always check the time against some start time, but constantly reset the start time when the condition is NOT true

so if the condition is true for 9.9 minutes, the start time could be reset at 9.91 minutes preventing the action being taken

The function "millis()" returns an unsigned long int value, so your variable "startMillis" needs to be declared as such or the statement "if (millis() - startMillis >= interval)" will be True a whole lot more often than you expect.

Thus:

unsigned long int startMillis = millis();       // reset the clock