cargo fmt
This commit is contained in:
parent
850c629eca
commit
933fda9b2b
1 changed files with 6 additions and 13 deletions
|
@ -102,19 +102,15 @@ pub fn run_calendar(args: &CliArgs) {
|
||||||
// it is after sunrise, and before sunset
|
// it is after sunrise, and before sunset
|
||||||
output_state.has_bg = true;
|
output_state.has_bg = true;
|
||||||
output_state.is_sun = true;
|
output_state.is_sun = true;
|
||||||
output_state.gradient_angle_percentage = {
|
output_state.gradient_angle_percentage =
|
||||||
(now_mins - sun_rise) as f32
|
{ (now_mins - sun_rise) as f32 / (sun_set - sun_rise) as f32 };
|
||||||
/ (sun_set - sun_rise) as f32
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
// Check if the moon is up
|
// Check if the moon is up
|
||||||
if moonrise.is_some() {
|
if moonrise.is_some() {
|
||||||
let moon_rise = moonrise.clone().unwrap();
|
let moon_rise = moonrise.clone().unwrap();
|
||||||
if moonset.is_some() {
|
if moonset.is_some() {
|
||||||
let moon_set = moonset.clone().unwrap();
|
let moon_set = moonset.clone().unwrap();
|
||||||
if now_mins > moon_rise
|
if now_mins > moon_rise && now_mins < moon_set {
|
||||||
&& now_mins < moon_set
|
|
||||||
{
|
|
||||||
// moon is up
|
// moon is up
|
||||||
output_state.has_bg = true;
|
output_state.has_bg = true;
|
||||||
output_state.is_sun = false;
|
output_state.is_sun = false;
|
||||||
|
@ -142,17 +138,14 @@ pub fn run_calendar(args: &CliArgs) {
|
||||||
let moon_rise = moonrise.clone().unwrap();
|
let moon_rise = moonrise.clone().unwrap();
|
||||||
let moon_day = moonday.clone().unwrap();
|
let moon_day = moonday.clone().unwrap();
|
||||||
|
|
||||||
output_state.gradient_angle_percentage = {
|
output_state.gradient_angle_percentage =
|
||||||
(now_mins - moon_rise) as f32
|
{ (now_mins - moon_rise) as f32 / moon_day as f32 };
|
||||||
/ moon_day as f32
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
let moon_set = moonset.clone().unwrap();
|
let moon_set = moonset.clone().unwrap();
|
||||||
let moon_day = moonday.clone().unwrap();
|
let moon_day = moonday.clone().unwrap();
|
||||||
let begin_mins: i32 = moon_set - moon_day;
|
let begin_mins: i32 = moon_set - moon_day;
|
||||||
let time_since_rise = now_mins + (begin_mins.abs());
|
let time_since_rise = now_mins + (begin_mins.abs());
|
||||||
output_state.gradient_angle_percentage = time_since_rise as f32 / moon_set as f32;
|
output_state.gradient_angle_percentage = time_since_rise as f32 / moon_set as f32;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue