Skip to content
New issue

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

Day value gets changed by 10 days when using makeTime #153

Open
DaleSchultz opened this issue Sep 23, 2020 · 0 comments
Open

Day value gets changed by 10 days when using makeTime #153

DaleSchultz opened this issue Sep 23, 2020 · 0 comments

Comments

@DaleSchultz
Copy link

#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

#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() {
  }

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant