Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

getEpoch() returns wrong epoch on Arduino NANO #18

Open
nicknugget opened this issue Aug 31, 2023 · 5 comments
Open

getEpoch() returns wrong epoch on Arduino NANO #18

nicknugget opened this issue Aug 31, 2023 · 5 comments

Comments

@nicknugget
Copy link

When calling getEpoch it returns an Epoch that is 36 years (!) in the future, despite date and time are set and shown correctly.

Simple test code:

#include <Arduino.h>
#include <I2C_RTC.h>

static PCF8563 RTC;

void setup(void) {
  Serial.begin(9600);
  while (!Serial)
    ;

  // Start RTC and check status
  RTC.begin();
  if (!RTC.isRunning()) {
    RTC.setDateTime(__DATE__, __TIME__);
    RTC.updateWeek();    
  }
}

void loop(void) {
  if (RTC.isRunning()) {
    Serial.print("Time: ");
    Serial.print(RTC.getHours());
    Serial.print(":");
    Serial.print(RTC.getMinutes());
    Serial.println();
    Serial.print("Date: ");
    Serial.print(RTC.getDay());
    Serial.print("-");
    Serial.print(RTC.getMonth());
    Serial.print("-");
    Serial.print(RTC.getYear());
    Serial.println();
    Serial.print("Epoch: ");
    Serial.print(RTC.getEpoch());
    Serial.println();
    delay(1000);
  }
}

Output:

Time: 9:35
Date: 31-8-2023
Epoch: 2832768244
@cvmanjoo
Copy link
Owner

cvmanjoo commented Mar 5, 2024

Which nano board exactly?

@DavidMS51
Copy link

I am finding this problem with a 'generic' v3 nano clone

@cvmanjoo
Copy link
Owner

Arduino nano uses Atmega328p itself, right?

@DavidMS51
Copy link

yes that is correct

@cvmanjoo
Copy link
Owner

cvmanjoo commented Dec 6, 2024

Fixed in v1.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants