Skip to content

Commit 111dc37

Browse files
author
arthurmelton
committed
timeh cant get numbers passed throught
1 parent b5f1abb commit 111dc37

File tree

1 file changed

+52
-9
lines changed

1 file changed

+52
-9
lines changed

src/run/functions.rs

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,15 @@ pub fn getstring(
771771
}
772772
skips = leng;
773773
} else if vec[y] == "timeh" {
774-
imput_s.push_str(time_readable().to_string().as_str());
774+
imput_s.push_str(time_readable(y,
775+
vec.to_vec(),
776+
memory_names.clone(),
777+
memory_values.clone(),
778+
memory_types.clone(),
779+
func_names.clone(),
780+
func_par.clone(),
781+
func_code.clone(),
782+
dev,).to_string().as_str());
775783
let mut leng = 0;
776784
let mut n2 = 0;
777785
let mut skip1 = false;
@@ -1597,14 +1605,49 @@ pub fn trim(
15971605
};
15981606
}
15991607

1600-
pub fn time_readable() -> String {
1601-
let time = time();
1602-
let d = UNIX_EPOCH + Duration::from_millis(time as u64);
1603-
// Create DateTime from SystemTime
1604-
let datetime = DateTime::<Utc>::from(d);
1605-
// Formats the combined date and time with the specified format string.
1606-
let timestamp_str = datetime.format("%Y-%m-%d %H:%M:%S.%f").to_string();
1607-
timestamp_str
1608+
pub fn time_readable(
1609+
x: usize,
1610+
contents: Vec<String>,
1611+
memory_names: Vec<String>,
1612+
memory_values: Vec<String>,
1613+
memory_types: Vec<String>,
1614+
func_names: Vec<String>,
1615+
func_par: Vec<String>,
1616+
func_code: Vec<String>,
1617+
dev: bool,) -> String {
1618+
let getstirng = getstring(
1619+
x,
1620+
contents,
1621+
memory_names,
1622+
memory_values,
1623+
memory_types,
1624+
func_names,
1625+
func_par,
1626+
func_code,
1627+
dev,
1628+
0,
1629+
);
1630+
if getstirng.len() > 0 {
1631+
let time:f64 = getstirng
1632+
.first()
1633+
.unwrap().parse().unwrap();
1634+
println!("{}", time);
1635+
let d = UNIX_EPOCH + Duration::from_millis(time as u64);
1636+
// Create DateTime from SystemTime
1637+
let datetime = DateTime::<Utc>::from(d);
1638+
// Formats the combined date and time with the specified format string.
1639+
let timestamp_str = datetime.format("%Y-%m-%d %H:%M:%S.%f").to_string();
1640+
return timestamp_str
1641+
}
1642+
else {
1643+
let time = time();
1644+
let d = UNIX_EPOCH + Duration::from_millis(time as u64);
1645+
// Create DateTime from SystemTime
1646+
let datetime = DateTime::<Utc>::from(d);
1647+
// Formats the combined date and time with the specified format string.
1648+
let timestamp_str = datetime.format("%Y-%m-%d %H:%M:%S.%f").to_string();
1649+
return timestamp_str
1650+
}
16081651
}
16091652

16101653
pub fn get_line(x: usize, contents: Vec<String>) -> i32 {

0 commit comments

Comments
 (0)