From 33c8fc7bdc1d299301a9713cefdf85f27a1b7b69 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 28 Jun 2023 13:41:00 -0400 Subject: feat: add convertto commands --- src/utils.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/utils.rs') 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) +} -- cgit v1.2.3