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(t) seems to return incorrect value #162

Open
nilton61 opened this issue Nov 21, 2022 · 0 comments
Open

day(t) seems to return incorrect value #162

nilton61 opened this issue Nov 21, 2022 · 0 comments

Comments

@nilton61
Copy link

I have the following function to calculate the civil dawn time:

#include <ezTime.h>
#include <ESP8266WiFi.h>
#include <SolarCalculator.h>

calculate dawn(t){
  Serial.println("calculating dawn");
  Serial.println("time passed to calculate dawn: " + dateTime(t));
  double tr, dawn, dusk;
  calcCivilDawnDusk(t, latitude, longitude, tr, dawn, dusk);
  Serial.println("t after calculation: " + dateTime(t));
  dawn += 1.0;//needs to be offset
  Serial.print("day t: ");
  Serial.println(day(t));//this prints the wrong value, 21(today) instead of 22 on my test run
  ....
}

I got some suspicious result, that's why i inserted the print statements and i got the following:

calculating dawn
time passed to calculate dawn: Tuesday, 22-Nov-2022 00:00:01 CET
t after calculation: Tuesday, 22-Nov-2022 00:00:01 CET
day t: 21

It seems that day(t) ignores the t parameter and uses the current time.
If this is my error that i missed somewhere i apologize and I'll be grateful if you point it out to me

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