RTC and TimeAlarms...how to use SetSyncProvider?

Hello, new guy here working on a controller for my fish tank. I’ve cobbled together code to display the time and temp on a LCD using a RTC_DS1307 and a DS18S20 thermometer. Additionally, a relay-controlled fan is turned on when the temp rises.

I want the fan to turn off at certain times of the day regardless of temperature and think TimeAlarms is the library to do it, but can’t figure out how to use SetSyncProvider.

Help?

#include <Wire.h>
#include "RTClib.h"
#include <OneWire.h>
#include <LiquidCrystal.h>
#include <Time.h>


int DS18S20_Pin = 7; //temp

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

RTC_DS1307 RTC; //timer


OneWire ds(DS18S20_Pin); //temp

unsigned long a=0;
unsigned long b = 0;

void setup(void) {
  
Wire.begin();
RTC.begin();  
lcd.begin(20, 4);
lcd.print("Time :");
pinMode(8, OUTPUT);


}


void loop(void) {
float temperature = getTemp();
float tempF = (temperature * 9.0)/ 5.0 + 32.0;

DateTime now = RTC.now();
  
  lcd.setCursor(7, 0);
     if ( now.hour() < 10) {
      lcd.print("0");
}
     lcd.print(now.hour(), DEC);
    lcd.print(':');
   if ( now.minute() < 10) {
    lcd.print("0");
}
    lcd.print(now.minute(), DEC);
    lcd.print(':');
    if ( now.second() < 10) {
    lcd.print("0");
}
    lcd.print(now.second(), DEC);
          
    lcd.setCursor(0, 1);
    lcd.print("Temp : ");
    lcd.print(tempF);
    lcd.print(" *F ");
    lcd.setCursor(0, 2);
    lcd.print("Temp : ");
    lcd.print(temperature);
    lcd.print(" *C ");
    lcd.setCursor(0, 3);
    lcd.print("Fan1 : ");
if(b ==0) a = millis();
b=millis();
if(b-a>=600000){//60000 being the number of milliseconds in a minute
b = 0;

if ( tempF  > 79) {  
digitalWrite(8, HIGH);
   lcd.print(" ON ");

}
if ( tempF  < 79) {  
digitalWrite(8, LOW);
   lcd.print(" OFF ");

}
}
}



float getTemp(){
//returns the temperature from one DS18S20 in DEG Celsius

byte data[12];
byte addr[8];

if ( !ds.search(addr)) {
//no more sensors on chain, reset search
ds.reset_search();
return -1000;
}



ds.reset();
ds.select(addr);
ds.write(0x44,1); // start conversion, with parasite power on at the end

byte present = ds.reset();
ds.select(addr);
ds.write(0xBE); // Read Scratchpad


for (int i = 0; i < 9; i++) { // we need 9 bytes
data[i] = ds.read();
}

ds.reset_search();

byte MSB = data[1];
byte LSB = data[0];

float tempRead = ((MSB << 8) | LSB); //using two's compliment
float TemperatureSum = tempRead / 16;

return TemperatureSum;

}

Here is a sketch which uses the Time library and setSynchProvider() with RTClib.h.

#include <Wire.h>         //http://arduino.cc/en/Reference/Wire (included with Arduino IDE)
#include "RTClib.h"
#include <Time.h>         //http://www.arduino.cc/playground/Code/Time  
RTC_DS1307 RTC;

uint32_t syncProvider()
{
  return RTC.now().unixtime();
}

void setup(void)
{
  Serial.begin(9600);
  Wire.begin();
  RTC.begin();
  setSyncProvider(syncProvider);   // the function to get the time from the RTC
  if(timeStatus() != timeSet) 
    Serial.println("Unable to sync with the RTC");
  else
    Serial.println("RTC has set the system time");      
}

void loop(void)
{
  timeDateDisplay();  
  delay(1000);
}

void timeDateDisplay(void)
{
 
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(' ');
  Serial.print(month());
  Serial.print("/");
  Serial.print(day());
  Serial.print("/");
  Serial.print(year()); 
  Serial.println(); 
  Serial.print("Unix Time ");
  Serial.println(now());
  Serial.println();
}

void printDigits(int digits)
{
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(':');
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}