In the following sketch when the minute is decremented past zero, the hour is decrementing by 4 instead of 1, and the minute goes to 15 instead of 59.
The same decrementing is applied to the day, but in that case the month decrements correctly.
What am I doing wrong?
`#include <TimeLib.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
delay(250);
Serial.println();
setTime(5, 5, 0, 5, 5, 2021);
}
void loop()
{
// put your main code here, to run repeatedly:
digitalClockDisplay();
delay(100);
}
void digitalClockDisplay()
{
// digital clock display of the time
setTime(hour(), minute()-1, second(), day()-1, month(), year());
Serial.print(hour());
printDigits(minute());
// printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
// Serial.print(year());
Serial.println();
}
void printDigits(int digits) {
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if (digits < 10)
Serial.print('0');
Serial.print(digits);
}`