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

Increase time accuracy #102

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

WhymustIhaveaname
Copy link

  • increase time accuracy to not above 100ms
    • complete decimal part of NTP
    • use high-freq polling
    • add _current_epoc_dec and get_millis() so that ms can be known
  • rewrite update()
    • solved overflow problem
    • change update()'s return type to byte in order to carry more info
    • add a not-request-too-fast feature by adding _last_fail in update()

I also add a demo program. I set an NTP Server in my LAN. In this network condition, the time error can be reduced to no more than plus-minus 10ms.

@fededim
Copy link

fededim commented May 12, 2020

Any plan to fix and merge this PR soon ?

@fededim
Copy link

fededim commented May 13, 2020

The build fails for these 2 errors:

/home/travis/build/arduino-libraries/NTPClient/examples/ntp_demo.ino: In function 'void connect_wifi(char*, char*)':
ntp_demo:28:25: error: 'class WiFiClass' has no member named 'channel'
     Serial.println(WiFi.channel());
                         ^
ntp_demo:30:25: error: 'class WiFiClass' has no member named 'getAutoReconnect'
     Serial.println(WiFi.getAutoReconnect());

Unluckily the functions channel and getAutoReconnect exist in WiFi, so it's strange that gives such errors. @Testato can you do a check and let us know ?

@WhymustIhaveaname
Copy link
Author

I have tested these codes on my esp32. It works very well. It has run for half a month without a bug or crash.

These prints are not important. They are just showing what information one can get from WiFi.

@fededim
Copy link

fededim commented May 13, 2020

According to log the build is done with platform esp8266, which is a little bit different from esp32. I hope that all Arduino library functions are present in every supported platform.

@wujiang
Copy link

wujiang commented Feb 8, 2021

Any plans to get this merged?

@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 linked an issue Nov 5, 2021 that may be closed by this pull request
@per1234 per1234 changed the title Solve issue #101 Increase time accuracy Jun 23, 2024
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An 0.5s System Error
6 participants