Overrule Ntp Server? #6
Replies: 17 comments
-
I'm in the middle of a large refactoring of the library, so you may be looking at an older version of the library that is currently on my machine. I think you are referring to the The constructor With regards to the second question, are you asking if the NTP hostname can be changed after the |
Beta Was this translation helpful? Give feedback.
-
Hi @bxparks thanks for your quick response. Yes, I just noticed that you are refactoring and splitting off AceTimeClock into its own library. You understood me correctly, if I may make a suggestion I would like all those constructed parameters as variables. Thru some an API call like this: Or: |
Beta Was this translation helpful? Give feedback.
-
You may want to rename the src directory to some other then |
Beta Was this translation helpful? Give feedback.
-
I think that is a reasonable feature request. Just out of curiosity, when would you need this feature, and how would you know when to change to a different hostname? I'm on the road right now, so I don't have the hardware to test this. If you want make these changes on your machine, and do some preliminary testing, that would be helpful. |
Beta Was this translation helpful? Give feedback.
-
With regards to the directory name |
Beta Was this translation helpful? Give feedback.
-
I get your refactoring choice. It makes sense to stabilize first. |
Beta Was this translation helpful? Give feedback.
-
Easy, I have a firmware and users that want to be able to use it in a locked down network with local gateway acting as an NTP server. So the NTP server needs to be configurable, so after boot they can change it thru the UI. It's not changing all the time, but the order I would use it is simple: Setup(){ } I would actually suggest that you drop the WiFi SSID and Password myself. In most cases it's quite easy to setup WiFi, people on esp platform tend to use something like ManageWifi. So easily manage WiFi credentials. I would change the api to something like: myNtp.begin(); And some defaults and then have setServer, setLocalport and setRequestTimeout. I read you are considering a asynchronous NTP response handeling. Maybe you could do the myNTP.loop(); I will look into how it could be refactored. |
Beta Was this translation helpful? Give feedback.
-
All 3 parameters of the Your request to make the configuration parameters mutable at runtime makes sense. I would want to double check that there is no tricky mutable state being stored that might interfere with changing those configuration parameters. I replied in your other thread that the retry logic lives in The other thing that's on my backlog is to look at the native sntp clients in the ESP8266 and ESP32 platforms. It ought to be possible to use that native client, wrap a thin |
Beta Was this translation helpful? Give feedback.
-
I will go an check to see if there is a good ESP NtpClient. I used ezTime, but it has some issues:
So I have been playing with a couple of libraries just to replace ezTime, your TZ manager looks amazing. |
Beta Was this translation helpful? Give feedback.
-
I am looking at the ESPNtpClient, with high accuracy NTP sync. And I will see if I can make it work with AceTime. |
Beta Was this translation helpful? Give feedback.
-
So I am now down to the configTime interface from the Arduino core. Which is just a wrapper on top of the ESP SDK. I think that will be the solution. No library, just a few calls to the core SDK. So I will end up using the AceTime library to manage the TZ stuff. Thanks for pointing me toward SNTP. You remark that a simple wrapper triggered me to find it. Now I don't understand why people even use more than that 😱 |
Beta Was this translation helpful? Give feedback.
-
I think the SNTP clients are not well documented, so easy to miss. I finished the refactoring of AceTime into AceTime/AceTimeClock, so I'm moving this to AceTimeClock. |
Beta Was this translation helpful? Give feedback.
-
Moving to Discussions. |
Beta Was this translation helpful? Give feedback.
-
@rvdbreemen : I recently released AceTime v1.10.0 and AceTimeClock v1.0.4, which gave me the opportunity to look more closely at the SNTP client on the ESP8266 and ESP32. As I suspected, it's pretty easy to use, but poorly documented. I added some stuff to my libraries to provide better integration with the ESP built-in libraries:
|
Beta Was this translation helpful? Give feedback.
-
@bxparks I will look at this, I guess this makes it more easy to include it into my own project. I fixed it myself by using the ESP function configTime by now, and that works too. But I like your project and I know you spend time on this subject. So I wonder what you found out as the documentation on ESP side is missing indeed. |
Beta Was this translation helpful? Give feedback.
-
When looking at your code example, I wondered why I remember the 1 hour limit. And I went to find it for you, just follow this link: As you will find it indeed has a 60 minutes default in there, so actually it's well documented in the code base itself. You just need to go down a deep deep rabbit hole to find it. It just boggled my mind that it was down all the way in the lwip2 stack. Remember that's a closed part of the ESP SDK. So I remembered looking for that source code too, and its an open-source lightweight IP stack, you can find more on the lwip stack here: https://savannah.nongnu.org/projects/lwip/ And here on their git repo: https://git.savannah.nongnu.org/cgit/lwip.git/log/?h=STABLE-2_1_3_RELEASE Here you can find the 64bit time construct, that is seconds and a fraction of seconds. If you remember I was talking about a while back on another discussion. So I hope this helps you to correctly document your ESP example, as it is maybe hard to find, there is a good source code base available, and some people keep telling me to look at the code and then look at the documentation, because docs are always behind on source. |
Beta Was this translation helpful? Give feedback.
-
Hi, Some tips may be already answered: Sorry I am not an expert in C++ (I am not an expert in anything) You can use:
Another question is to implement some kind of ramdomize source port, better for security. Best Regards. |
Beta Was this translation helpful? Give feedback.
-
I have been playing around with your library, I love the fact that you have managed to statically link all timezones in the library.
I wonder how I can change the ntp server hostname itself? Do you have an example how to do this?
Is there a way to overwrite the default dynamically after the clock has been created in the firstplace?
Beta Was this translation helpful? Give feedback.
All reactions