General area when it fits no where else

Moderator: Mmiscool

User avatar
By PhilTilson
#64190 Usually, the 8266 will set its time and date when it connects to the internet - and that seems to work very effectively. However, that requires an internet connection, obviously.

The problem is, when the 8266 acts as an AP, there doesn't seem to be any way to set the time. I have it linked to a DS1307 chip and can quite happily get the correct time and date from this, but there doesn't appear to be any way to input this to the 8266 so as to update its internal clock.

Even the I2C example on the documentation page has the comment: "Example of updating the time and/or date" - but of course, it doesn't so this; it just reads the time and date into local variables. You may say that, if I can access a DS1307, why do I need to update the internal clock?

Well, that may be a fair point, but it seems logical that there should be a way to set the internal timer other than by connecting to the internet.

Any ideas?

Phil
User avatar
By heckler
#64193 I was unaware that the 8266 had an internal clock.
My assumption was that TIME() simply requested time from an NTP server and you had to read it into local variables.

Then somewhere else here I read that others believed that it was actually TIMESETUP(tz,dst) that connected with the NTP time server and updated the 8266 internal clock.

Which is it??

And, by the way, I have yet to get the "dst" part of TIMESETUP() to even make a difference. Either I don't know how to apply it or it is not working.

Help us mister wizard!

dwight
User avatar
By picstart
#64205 The esp8266 has an internal ticker ...it just ticks at a fixed rate and it can measure elapsed time only.
Now if your code is informed some other way with a time stamp the esp8266 internal clock can be used to increment the time stamp ( keep time) via its fixed ticking rate after the fixed ticking rate is converted to say seconds by you code and your code updates the days hours minute and seconds of the time stamp .
Perhaps the issue is that a computer clock is just a ticker and not the same as a watch or clock on a wall.
User avatar
By PhilTilson
#64406 I had always understood (assumed?) that heckler's explanation was the correct one - that there was some form of internal clock that was updated periodically by accessing a time server.

If this is not the case, and picstart's explanation is the correct one, then that could be very tricky for applications that have a real-time function if there is anything other than a completely reliable internet connection. After all, a wi-fi connection with other bits of kit is quite possible without an internet connection.

I, too, would like to know the facts!

Phil