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

Clarification #42

Closed
guestisp opened this issue May 22, 2022 · 1 comment
Closed

Clarification #42

guestisp opened this issue May 22, 2022 · 1 comment
Labels
good first issue Good for newcomers

Comments

@guestisp
Copy link

Ciao,
simple question: syncing from NTP automatically syncs the ESP32 internal clock ? Any further requests to NTP.getTimeDateString() or NTP.getTimeString() are done from the internal clock without usingn network, right ? In other words , after the first sync, the network is not required anymore (except for the scheduled ntp syncs)

Do you know how to update the DS3231 RTC ? I'm trying to use ntp as the initial sync, then update an RTC to keep the time updated even when powered off

@gmag11
Copy link
Owner

gmag11 commented Jun 7, 2022

You are right. The intention of this lib is to sync internal IDF clock. Notice that, unless you need very high precision, this library is redundant as IDF already has an internal SNTP client.

You can configure it as simple as adding this to your setup() function:

sntp_setservername (0, "pool.ntp.org");
setenv ("TZ", PSTR ("CET-1CEST,M3.5.0,M10.5.0/3"), 1); //set your time zone
tzset ();
sntp_init ();

In order to set any RTC you can use a sync event callback. Both EspNtpClient library and internal SNTP IDF client have their own event callbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants