Need to create an if function for a variable rising in a time limit.

Hi.

I'm trying to work out how to implement a probably very simple bit of code. What I want to achieve is if a variable has remained the same in the last 90 seconds to execute a program else remain executing the current code.

I am aware of interrupts but this only appears to be on pins not variables (I'm using a hall effect sensor so attaching to the pin will be of little use)

its purely so I can save power and calculate separate events

I am happy to post full code but its very long.

effectively I want my loop code operates like so:

If flow rate risen in 90seconds{

turn on display display variables

else

turn off display store variables onto SD card rest varibles to 0

Assuming something is reading the flowrate every iteration through loop() ... Assuming when the rate is steady that it is exactly the same each time (which may not be true) ...

I think this pseudo code will do the trick

  if (newFlowRate == oldFlowRate) {
     doNothing();
   }
   else if (millis() - savedMillis > 90000) { // hope that's 90 secs
     doSomething();
     savedMillis = millis(); // to start the next time count
     oldFlowRate = newFlowRate;
   }

... or something fairly similar

...R