Well here's another fairly clean cut example. Might help.
#define ONEMINUTE 60000
unsigned long lastminute;
int minutes = 0; // either set these to starting values
int hours = 0; // or switch on at midnight!
bool running = false;
void setup(){
// whatever else you want here
lastminute = millis(); // should be last command in setup
}
void loop{
if (millis() - lastminute >= ONEMINUTE){
lastminute += ONEMINUTE;
minutes += 1;
if (minutes == 60){
minutes = 0;
hours += 1;
if (hours == 24){
hours == 0;
}
}
}
if (not running and hours == 8 and minutes == 30){ // just examples
running = true;
}
else if (running and hours == 17 and minutes == 0){
running = false;
}
if (running){
// some function here
}
// some other code here too
}
This will correctly handle millis() wrap around zero and also step over any other code functions provided the overall loop time is less than 1 minute!