use crate::time::solar_time::{calc_time_correction, calc_utc_offset};
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Location {
pub longitude: f64,
pub latitude: f64,
}
impl Location {
pub fn new(longitude: f64, latitude: f64) -> Self {
Self {
longitude,
latitude,
}
}
pub fn calc_utc_offset(&self) -> f64 {
calc_utc_offset(self.longitude)
}
pub fn calc_time_correction(&self, tz_offset: f64) -> i64 {
calc_time_correction(self.longitude, tz_offset)
}
}
impl std::hash::Hash for Location {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.longitude.to_bits().hash(state);
self.latitude.to_bits().hash(state);
}
}