# seconds and minutes

Dear all

I'm trying to do a clock but every time segundos arrive to 60, segundos and minutos are changed only in one second, then start to add 1 again to segundos and minutos return to 0. Could some one please help me with it.

``````int segundos =  millis() / 1000;
int minutos  =  millis() / 60000;
int hora = millis() / 3600000;

if(segundos== 60){
segundos=0;
minutos=minutos+1;
}

if(minutos==60){
minutos=0;
hora = hora+1;
}
``````
``````uint32_t now = millis();
now /= 1000;
int setundos =  now % 60;
now /= 60;
int minutos  =  now % 60;
now /= 60;
int hora = now % 24;
``````

int minutos = millis() / 60000ul; int hora = millis() / 3600000ul;

``````unsigned long t = millis() / 1000;
int segundos, minutos, hora;
hora = t / 3600;
t = t % 3600;
minutos  =  t / 60;
t = t % 60
segundos =  t % 60;
``````

larryd: 1. Reading millis() multiple times is bad. 2. Your code gives the total elapsed seconds, minutes and hours, not individual parts of the current time.

By the way the OP is subsequently attempting to manipulate their values (and more to the point that they state they are trying to make a clock) is apparent that’s almost certainly NOT what they want.