-
-
Notifications
You must be signed in to change notification settings - Fork 127
FAQ #4
Michael Miller edited this page Mar 4, 2017
·
4 revisions
You have two choices that will both work. Either you can use this library to access the RTC device or you can used a modified version of this library that fully embraces the standard C time API.
It is simple to use the time_t type to retrieve and set the time. Just include time.h
and replace the RtcDateTime object you normally use with time_t and the method calls to modify it.
To get time just do this ...
time_t now = Rtc.GetDateTime();
and to set time just do this ...
time_t now; // initialize it how ever you want
Rtc.SetDateTime(now);
Now you can use the rest of the standard C time API with the time_t variable;
Instead of using this library, use the modified version of this library from here GitHub/Smz/Arduino-RTCtime. You can find it in the library manager as "RTCtime by smz".