Voici une fonction qui me permet de transformer millis() en jours, heures, minutes et secondes.
void milli2JHMS()
{
unsigned long depart;
depart=millis()/1000;
depart=(286400)+(223600)+(4560)+39;//254739
//depart=(286400)+(93600)+(93600)+(43600)+(4560)+39;
time_start[0]=depart/86400;
time_start[1]=(depart%86400)/3600;
time_start[2]=(depart%3600)/60;
time_start[3]=depart%60;
}
time_start est déclarée : byte time_start[4];
Pour vérifier ma fonction, je récupère time_start dans une trame UDP udp.write(time_start,4); qui me donne :
0x02 0x04 0x21 0x17 soit en décimal 2j 4h 33mn 23s
Si je dé-commente la troisième ligne "depart" j'obtiens le bon calcul soit :
0x02 0x16 0x2D 0x27 soit en décimal 2j 22h 45mn 39s
Je ne comprends pas pourquoi "(223600)" ne fonctionne pas alors que "(93600)+(93600)+(43600)" fonctionne très bien.