Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Time constructor from unix timestamp #12

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

Conversation

MarcelRobitaille
Copy link

This PR adds a constructor that builds Time from a unix timestamp. This is build on a similar constructor in Adafruit RTClib. That code is MIT, so it should be fine to copy. BTW, you should consider adding a license for this library.

The reason for this change is that I would like to keep my RTC in sync using the network time protocol, and the code I found to do this gives the current time in the unix timestamp.

Adafruit encodes a year offset since 2000. Thus, we have to add 2000
when getting time from a unix timestamp.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant