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

add minmea_getdate() #45

Merged
merged 5 commits into from Jun 2, 2022
Merged

add minmea_getdate() #45

merged 5 commits into from Jun 2, 2022

Conversation

benpicco
Copy link
Contributor

I needed a struct tm instead of a Unix timestamp.
The struct is already being assembled in minmea_gettime() and converting struct tm -> time_t -> struct tm is silly, so I added a function to make that functionality available for external users.

benpicco added a commit to benpicco/RIOT that referenced this pull request Feb 13, 2020
Add a fucntion to expose the internal `struct tm` that is populated
with the GPS date.

This allows for easy syncing the RTC with the GPS time without having
to convert back and forth between `struct tm` and `time_t`.

    struct tm now;
    minmea_getdate(&now, data, time);
    rtc_set_time(&now)

upstream PR: kosma/minmea#45
@benpicco benpicco requested a review from kosma February 13, 2020 15:01
@kosma
Copy link
Owner

kosma commented May 20, 2022

Needs tests before we can merge.

minmea.c Outdated Show resolved Hide resolved
minmea.c Show resolved Hide resolved
The GPS date is internally converted to a struct tm anyway.
Add a function to make use of this for external users too.
@kosma kosma merged commit 6915c08 into kosma:master Jun 2, 2022
@kosma
Copy link
Owner

kosma commented Jun 2, 2022

Merged. Thanks for this contribution, it does indeed make sense and should have been in the library from the beginning!

Changes I did to the original PR:

  • added tests
  • renamed the function minmea_getdatetime() as "getdate" is misleading - it doesn't just get the date but date+time
  • some minor style changes

@benpicco benpicco deleted the minmea_getdate branch June 3, 2022 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants