When I run this program the initial timestamp is: 4294880896 not zero like I would expect. Setting the timestamp indirectly with the date/time functions works.
`#include
include
swRTC rtc; //create a new istance of the lib
void setRTC(int year, int month, int day, int hour, int min, int sec) {
rtc.setTime((byte)hour, (byte)min, (byte)sec);
rtc.setDate((byte)day, (byte)month, year);
}
void setupRTC() {
rtc.stopRTC(); //stop the RTC
// Set software RTC to default date/time
//rtc.setDate(1, 1, 1970);
//rtc.setTime(0,0,0);
//setRTC(1970,1,1,0,0,0);
rtc.setClockWithTimestamp(0, 1970);
rtc.startRTC(); // start the RTC
}
When I run this program the initial timestamp is: 4294880896 not zero like I would expect. Setting the timestamp indirectly with the date/time functions works.
`#include
include
swRTC rtc; //create a new istance of the lib
void setRTC(int year, int month, int day, int hour, int min, int sec) { rtc.setTime((byte)hour, (byte)min, (byte)sec); rtc.setDate((byte)day, (byte)month, year); }
void setupRTC() { rtc.stopRTC(); //stop the RTC // Set software RTC to default date/time //rtc.setDate(1, 1, 1970); //rtc.setTime(0,0,0); //setRTC(1970,1,1,0,0,0); rtc.setClockWithTimestamp(0, 1970); rtc.startRTC(); // start the RTC }
void setup() { Serial.begin(9600); setupRTC(); }
void loop() { Serial.println(rtc.getTimestamp(1970)); } `