1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#![warn(clippy::cargo, clippy::nursery, clippy::pedantic)]
use hifitime::{Epoch, TimeUnits};
use std::str::FromStr;
pub fn msd_now_flt() -> f64 {
let dt_tm = Epoch::now().unwrap();
let jde_tt = dt_tm.to_jde_tt_days();
let mars_sol_date_now_float: f64 = (jde_tt - 2405522.0028779) / 1.0274912517;
return mars_sol_date_now_float;
}
pub fn mtc_now_flt() -> f64 {
let mars_sol_date_now_float = msd_now_flt();
let martian_coordinated_time_now_float: f64 = mars_sol_date_now_float.rem_euclid(1.0) * 24.0;
return martian_coordinated_time_now_float;
}
pub fn mtc_now_fmt() -> String {
let martian_coordinated_time_now_float = mtc_now_flt();
let martian_coordinated_time_now_formatted = TimeUnits::hours(martian_coordinated_time_now_float);
return martian_coordinated_time_now_formatted.to_string();
}
pub fn msd_flt(arg1: &str, arg2: &str, arg3: &str) -> f64 {
let date_time_scale = arg1.to_owned() + " " + arg2 + " " + arg3;
let dt_tm = Epoch::from_str(&date_time_scale);
let jde_tt = dt_tm.unwrap().to_jde_tt_days();
let mars_sol_date_float: f64 = (jde_tt - 2405522.0028779) / 1.0274912517;
return mars_sol_date_float;
}
pub fn mtc_flt(arg1: &str, arg2: &str, arg3: &str) -> f64 {
let mars_sol_date_float = msd_flt(arg1, arg2, arg3);
let martian_coordinated_time_float: f64 = mars_sol_date_float.rem_euclid(1.0) * 24.0;
return martian_coordinated_time_float;
}
pub fn mtc_fmt(arg1: &str, arg2: &str, arg3: &str) -> String {
let martian_coordinated_time_float = mtc_flt(arg1, arg2, arg3);
let martian_coordinated_time_formatted = TimeUnits::hours(martian_coordinated_time_float);
return martian_coordinated_time_formatted.to_string();
}