Skip to content

getEpoch has a race condition causing it to be off by one day #114

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

Closed
ant32 opened this issue Dec 19, 2024 · 0 comments · Fixed by #115
Closed

getEpoch has a race condition causing it to be off by one day #114

ant32 opened this issue Dec 19, 2024 · 0 comments · Fixed by #115
Labels
bug 🐛 Something isn't working
Milestone

Comments

@ant32
Copy link

ant32 commented Dec 19, 2024

Ran into an issue where the epoch time was off by exactly one day. This is caused by getEpoch function first reading date and then reading time. Date time may have rolled over to new day in between.

syncTime();

time_t STM32RTC::getEpoch(uint32_t *subSeconds)
{
  struct tm tm;

  syncDate();
  syncTime(); // <-- date may have changed and time sometimes reads 00:00:00 of the following date.

Discussion here
https://github.com/orgs/stm32duino/discussions/2600#discussioncomment-11545824

@fpistm fpistm added the bug 🐛 Something isn't working label Dec 20, 2024
@fpistm fpistm added this to the 1.6.1/1.7.0 milestone Dec 20, 2024
@github-project-automation github-project-automation bot moved this from To do to Done in STM32duino libraries Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

2 participants