Setting RTC From NTP


Author Message
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 883
Posted: 03:30am 02 Jan 2024      

Hi All and belated seasons greetings.

I'm fiddling with getting the Date/Time from NTP, having retrieved the Daylight Saving status from OpenWeather.
NTP automatically updates DATE$ & TIME$ but, as far as I can see, one must then update the RTC by say :
RTC SETTIME MID$(Date$,7,4)+","+ MID$(Date$,4,2)+","+MID$(Date$,1,2)+"," +MID$(Time$,1,2)+"," +MID$(Time$,4,2)+"," +MID$(Time$,7,2).

Is there sense in having a command like "RTC SETTIME NOW". It would be up to the user to only use this before the internal clock drifted (or have I lost the plot again?).

Cheers,

Andrew
Edited 2024-01-02 13:31 by Andrew_G