0

I have an I2C Real Time Clock, DS3231 RTC module , and I just want something like Unix Time. I'm using the uRTCLib, looking at the class methods but dont see anything like that. I'm thinking there must be a raw read that would return all the digits. Is there an easy way to do that?

Juraj
18.3k4 gold badges31 silver badges49 bronze badges
asked Dec 31, 2022 at 19:17
0

1 Answer 1

3

The DS3231 doesn't report the Unix time. It reports the current time in broken-down form (year, month... second). If you need Unix time, you have to compute it.

I suggest using Adafruit's RTClib. This library implements the computation of Unix time, e.g.

uint32_t unix_time = rtc.now().unixtime();
answered Dec 31, 2022 at 20:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.