summaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
authorseth <[email protected]>2023-06-28 13:41:00 -0400
committerseth <[email protected]>2023-06-28 13:41:00 -0400
commit33c8fc7bdc1d299301a9713cefdf85f27a1b7b69 (patch)
treeff83d8c5daf474a4dbf3d45d348057ffbfb8eaff /src/utils.rs
parentca089aadb68dd403ecb4c371994b0a5d40d3778b (diff)
feat: add convertto commands
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 4b56dc6..2713241 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -98,3 +98,17 @@ pub async fn bottom_decode(msg: &str) -> String {
}
}
}
+
+/*
+ * converts celsius to fahrenheit
+ */
+pub async fn celsius_to_fahrenheit(c: &f64) -> f64 {
+ (c * (9.0 / 5.0)) + 32.0
+}
+
+/*
+ * converts fahrenheit to celsius
+ */
+pub async fn fahrenheit_to_celsius(f: &f64) -> f64 {
+ (f - 32.0) * (5.0 / 9.0)
+}