We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adjustTime increments a leap year when it shouldn't. Leap year occur on 2020 and 2024.
Adding 12 hours to the date time 28/4/2022, hour=23. Gives 29/4/2022 hour=11. Should be 1/5/2022 hour=11.
Tested Using Arduino UNO (clone) Also tested with same result on a WeMos D1R1 board.
//Code copied and adjusted from TimeGPS example #include <TimeLib.h>
void setup() { Serial.begin(9600);
int Year = 2022; byte Month = 4; byte Day = 28; byte Hour = 23; byte Minute = 59; byte Second = 58;
const int offset = 12;
setTime(Hour, Minute, Second, Day, Month, Year); adjustTime(offset * SECS_PER_HOUR);
Serial.print(day()); Serial.print(" "); Serial.print(month()); Serial.print(" "); Serial.print(year()); Serial.println(); }
Result: 29 4 2022 2022 is not a leap year result should be 1 5 2022
The text was updated successfully, but these errors were encountered:
4 is the month of April. There's always 30 days in April, every year
Sorry, something went wrong.
No branches or pull requests
adjustTime increments a leap year when it shouldn't. Leap year occur on 2020 and 2024.
Adding 12 hours to the date time 28/4/2022, hour=23.
Gives 29/4/2022 hour=11.
Should be 1/5/2022 hour=11.
Tested Using Arduino UNO (clone)
Also tested with same result on a WeMos D1R1 board.
//Code copied and adjusted from TimeGPS example
#include <TimeLib.h>
void setup()
{
Serial.begin(9600);
int Year = 2022;
byte Month = 4;
byte Day = 28;
byte Hour = 23;
byte Minute = 59;
byte Second = 58;
const int offset = 12;
setTime(Hour, Minute, Second, Day, Month, Year);
adjustTime(offset * SECS_PER_HOUR);
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
}
Result: 29 4 2022
2022 is not a leap year result should be 1 5 2022
The text was updated successfully, but these errors were encountered: