ESP RTC Local Time

Clock[6]So there’s a nice project for the mathematically inclined.   My ESP boards get the time (summer time and location corrected) via MQTT where that’s worked out on a more powerful Raspberry Pi. They also get dusk and dawn times.

As it is possible on the ESP to get the time via NTP, and it is easy to add the regional offset, all that is missing is summer/winter time correction and dusk and dawn times in a stand-alone environment.  I found one piece of code which looked like it might do the job but it would not compile as all the various floating point libraries such as sin/cosine etc. etc. are all missing.

Is there another way to get local, summer adjusted time and date along with lighting up and dawn times, from a server without having to do lots of maths locally. Clearly one could write something on a server somewhere in PHP to do the job – but that might be re-inventing the wheel?


8 thoughts on “ESP RTC Local Time

  1. If it were me (and it might be soon) I would re-implement the sine/cosine stuff as several level deep Taylor expansions (just requires arithmetic). Care to point at the code you were looking at?

  2. Hi Peter/everyone,

    I've been looking for a solution for my problem on your site and code but cant find any. I'm using the Eclipse development platform and i'm trying to find similar implementation used on Arduino IDE for the function "millis()" so to check time lapsed from a point on the function to the other and cant really see how to do that (basically implementing a timeout in the order of the milliseconds and not seconds). Your RTC implementation gives the tm.seconds and i could use that but i need on the order of the milliseconds is it at all possible? Thanks again in advance.

Comments are closed.