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

adjtime implements olddelta incorrectly (IDFGH-3192) #5194

Closed
tve opened this issue Apr 26, 2020 · 2 comments
Closed

adjtime implements olddelta incorrectly (IDFGH-3192) #5194

tve opened this issue Apr 26, 2020 · 2 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@tve
Copy link

tve commented Apr 26, 2020

  • Module or chip used: ESP32-WROOM-32
  • IDF version (run git describe --tags to find it): v4.0 through v4.2

Problem Description

The POSIX and GNU libc definition of adjtime specifies:

If the olddelta argument is not a null pointer, the adjtime function returns information about any previous time adjustment that has not yet completed.

Note the word "previous". The ESP-IDF implementation incorrectly returns
the current time adjustment that has not yet completed, which is rather useless.

Fix

Swap the two outer if blocks in the adjtime function https://github.com/espressif/esp-idf/blob/master/components/newlib/time.c#L193.

@Alvin1Zhang
Copy link
Collaborator

@tve Thanks for reporting, we will look into.

@github-actions github-actions bot changed the title adjtime implements olddelta incorrectly adjtime implements olddelta incorrectly (IDFGH-3192) Apr 27, 2020
@KonstantinKondrashov
Copy link
Collaborator

Hi @tve!
Thanks for your report. I agree, now we need to call it twice to get the same result. I will fix it and provide backports up to 4.0.

espressif-bot pushed a commit that referenced this issue Sep 29, 2020
…evious adjustment

If the olddelta argument is not a null pointer, the adjtime function returns information
about any previous time adjustment that has not yet completed.

Closes: #5194
espressif-bot pushed a commit that referenced this issue Oct 18, 2020
…evious adjustment

If the olddelta argument is not a null pointer, the adjtime function returns information
about any previous time adjustment that has not yet completed.

Closes: #5194
espressif-bot pushed a commit that referenced this issue Nov 19, 2020
…evious adjustment

If the olddelta argument is not a null pointer, the adjtime function returns information
about any previous time adjustment that has not yet completed.

Closes: #5194
@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally labels May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants