Function sun_times::sun_times [] [src]

pub fn sun_times(
    date: Date<Utc>,
    latitude: f64,
    longitude: f64,
    elevation: f64
) -> (DateTime<Utc>, DateTime<Utc>)

Calculates the approximate sunset and sunrise times at a given latitude, longitude, and altitude

Arguments

  • date - The date on which to calculate the sunset and sunrise
  • latitude - The latitude at which to calculate the times. Expressed as degrees
  • longitude - The longitude at which to calculate the times. Expressed as degrees
  • elevation - The elevation at which to calculate the times. Expressed as meters above sea level

Return value

Returns a tuple of (sunrise,sunset)

Examples

//Calculate the sunset and sunrise times today at Sheffield university's new computer science building
let times = sun_times(Utc::today(),53.38,-1.48,100.0);
println!("Sunrise: {}, Sunset: {}",times.0,times.1);