DS3231 Library for AVR Atmega328p
Depends on https://github.com/ecnx/avr-i2c
Link to datasheet: https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
Library has RTC clock alarms and error reporting supported.
Set clock time example:
struct ds3231_clock_t clock = { 0 };
clock.minutes = 23;
clock.hours = 11;
ds3231_write_clock ( &clock ); // 0 = success