Open DaleSchultz opened 4 years ago
The day value gets corrupted by makeTime
convert a time element structure to a time and inspect the day value. It changed.
LoLin ESP8266 Arduino IDE version 1.8.13 Version info & package name (from Tools > Boards > Board Manager) 1.6.0
#include <TimeLib.h> void setup() { Serial.begin(115200); delay(1000); tmElements_t start; start.Year = 2020-1970; Serial.print("year "); Serial.println(start.Year); start.Month = 11; start.Day = 2; Serial.print("day "); Serial.println(start.Day); // prints 2 - correct time_t startdate = makeTime(start); Serial.print("converted day "); Serial.println(day(startdate)); // prints 12 - incorrect Serial.print("month "); Serial.println(month(startdate)); // prints 11 as expected Serial.print("year "); Serial.println(year(startdate)); // prints 2020 as expected } void loop() { }
09:27:13.596 -> year 50 09:27:13.596 -> day 2 09:27:13.596 -> converted day 12 09:27:13.596 -> month 11 09:27:13.596 -> year 2020
111 # Description
The day value gets corrupted by makeTime
Steps To Reproduce Problem
convert a time element structure to a time and inspect the day value. It changed.
Hardware & Software
LoLin ESP8266 Arduino IDE version 1.8.13 Version info & package name (from Tools > Boards > Board Manager) 1.6.0
Arduino Sketch
Errors or Incorrect Output
09:27:13.596 -> year 50 09:27:13.596 -> day 2 09:27:13.596 -> converted day 12 09:27:13.596 -> month 11 09:27:13.596 -> year 2020