Every time I reset my arduino, the year goes to 2106, and I don't know why...
// Date and time functions using just software, based on millis() & timer
#include <Wire.h>
#include "RTClib.h"
RTC_Millis rtc;
void setup () {
Serial.begin(9600);
// following line sets the RTC to the date & time this sketch was compiled
if(rtc.now().year() != "2017"){
Serial.println(rtc.now().year());
rtc.begin(DateTime(__DATE__, __TIME__));
}
//
}
void loop () {
DateTime now = rtc.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
Serial.print(" seconds since 1970: ");
Serial.println(now.unixtime());
// calculate a date which is 7 days and 30 seconds into the future
Serial.println();
delay(3000);
}
------------------
/*SERIAL MONITOR*/
------------------
*presses reset button*
2106 //year reset???
2017/9/23 16:27:32 //resetting to upload time