GrumpyOldPizza / arduino-STM32L4

69 stars 60 forks source link

RTC Libary not setting properly Butterfly #46

Closed jacky4566 closed 5 years ago

jacky4566 commented 5 years ago

Hey Grumpy, Having a small problem with the RTC library for this core. The epoch stuff seems to be a bit off.

#include <RTC.h>

void setup() {
  Serial.begin(9600);
  delay(2000);
  RTC.setEpoch(1565734851);
  Serial.println(RTC.getEpoch());
  RTC.setYear(2019);
  Serial.println(RTC.getEpoch());
}

Will print this

1565734851
3080499651

Not sure why setting the year causes such confusion.

jacky4566 commented 5 years ago

AH nevermind! The Year function is expecting the last 2 digits from 2000 onwards not the whole year.