I partially solved the problem using UNIX time, but now, the delay is being existing yet Anyone knows how to store the time with precission (using more variables or something like this)??? I tried a lot of methods, but the best option is the next....(I must to repeat that I don´t copy all code, because it has 1500 lines of length. But if you need it, I´ll post it. Thank you to everyone
DateTime now = RTC.now(); //Para obtener el tiempo unix
unsigned long currentTime = now.unixtime();//Obtiene el tiempo UNIX para el tiempo de refresco unicamente
if (currentTime -lastReadTime >= refresh_rate) {File logFile = SD.open("LOG.txt", O_CREAT | O_WRITE);//O_CREAT | O_WRITE puede cambiarse por FILE_WRITE
lastReadTime = currentTime;
logFile.print(monthDay);
logFile.print("/");
logFile.print(month);
logFile.print("/");
logFile.print(year);logFile.print(" - ");
logFile.print(hour);
logFile.print(":");
logFile.print(minute);
logFile.print(":");
logFile.print(second);logFile.print(",");//Separador de columna
for (int l=0; l<numSensoresT; l++)
{
logFile.print(temparray[l]);
if (l < numSensoresT-1)
{
logFile.print(",");
}
else
{
logFile.println();}
}logFile.close();
}