Chat freely about anything...

User avatar
By McChubby007
#75212 So there's a huge amount of code to look through - when you say the function gives the wrong result what did you expect and what did it give? Is it that function which is at fault, or another which sets date & time? What have you debugged so far? Give us a clue.
User avatar
By McChubby007
#75213 By the way, I notice a 'liberal smattering' of wdt resets in your code. What's going on there? I note that it boils down to a call to wdtFeed, which I never use - why was that chosen over a yield? Does it in fact also yield back control or only feed the watchdog? If the latter then you may get some odd behaviour if the other (system) context is not able to run often enough.
User avatar
By Sirquil
#75215 All of the "Fast_Time_Web_Interface.ino" is from working code using NTP Server using and older libraries; all functions except getDataTime function work correctly, when there are correctly working time routines. I use DOW, MONTH, DATE, YEAR, HOUR, MINUTE, SECOND and a date and time stamp for logging files.

The previous version "NTP_Web_Interface.ino" ran for several months with no issues; it was running ESP8266 version 2.3.0. This one is using ESP8266 version 2.4.1.

All that is produced by calling getDateTime function is"Thu Jul 13 02:38:21 2017." This is the first time I have worked with structures. What I find puzzling is "Time.ino" works producing updated date and time string. I took parts of Time.ino" adding variables to above setup, added "Time.ino" setup section to setup, added loop to new loop of my project. Created getDateTime function.

William
User avatar
By McChubby007
#75216 Take your working Time.ino clone it somewhere else and then put the other code which you suspect doesn't work into it - and then debug that - there will be far less code and in my opinion far fewer possibilities that there is in fact an error introduced by mistake in another place which you think works and/or was not changed. In other words - start with a small known working version and then introduce your suspect code until it stops working and then isolate the fault. This is instead of using a debugger, which is what I would use. Please ensure you understand how structs work, they are a basic building block of the language. You could also take the suspect function and feed it test data and see what it produces, add some prints for various variables etc (although I'm not a fan of lots and lots of prints as it can affect timing and lead to different results.