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