fn run_process_loop(lat: f64, long: f64) {
    // Get the sunset and sunrise times.
    let mut times = get_sunrise_and_sunset(lat, long, 8.0);
    
    loop {
        let current_time = Local::now();
        let sunrise = Local.from_utc_datetime(&times.0.naive_utc());
        let sunset = Local.from_utc_datetime(&times.1.naive_utc());
        
        // Set the theme to light mode
        if current_time.gt(&sunrise) && current_time.lt(&sunset) {
            set_theme(false);
        }

        // Set the theme to dark mode.
        if current_time.gt(&sunrise) && current_time.gt(&sunset) {
            set_theme(true);
        }

        times = get_sunrise_and_sunset(lat, long, 8.0);
        sleep(std::time::Duration::from_secs(60 * 10));
    }
}
// Runs a loop to check the sunset/sunrise time from the current time and change the theme based on the result.
Runs a loop to check the sunset/sunrise time from the current time and change the theme based on the result.
Runs a loop to check the sunset / sunrise time from the current time and change the theme based on the result .
fn run_process_loop(lat: f64, long: f64) {
    // Get the sunset and sunrise times.
    let mut times = get_sunrise_and_sunset(lat, long, 8.0);
    loop {
        let current_time = Local::now();
        let sunrise = Local.from_utc_datetime(&times.0.naive_utc());
        let sunset = Local.from_utc_datetime(&times.1.naive_utc());
        // Set the theme to light mode
        if current_time.gt(&sunrise) && current_time.lt(&sunset) {
            set_theme(false);
        }
        // Set the theme to dark mode.
        if current_time.gt(&sunrise) && current_time.gt(&sunset) {
            set_theme(true);
        }
        times = get_sunrise_and_sunset(lat, long, 8.0);
        sleep(std::time::Duration::from_secs(60 * 10));
    }
}
fn run_process_loop ( lat : f64 , long : f64 ) { // Get the sunset and sunrise times. let mut times = get_sunrise_and_sunset ( lat , long , 8.0 ) ; loop { let current_time = Local :: now ( ) ; let sunrise = Local . from_utc_datetime ( & times . 0 . naive_utc ( ) ) ; let sunset = Local . from_utc_datetime ( & times . 1 . naive_utc ( ) ) ; // Set the theme to light mode if current_time . gt ( & sunrise ) && current_time . lt ( & sunset ) { set_theme ( false ) ; } // Set the theme to dark mode. if current_time . gt ( & sunrise ) && current_time . gt ( & sunset ) { set_theme ( true ) ; } times = get_sunrise_and_sunset ( lat , long , 8.0 ) ; sleep ( std :: time :: Duration :: from_secs ( 60 * 10 ) ) ; } }
Runs a loop to check the sunset/sunrise time from the current time and change the theme based on the result.
Runs a loop to check the sunset / sunrise time from the current time and change the theme based on the result .
lat
f64
long
f64