aboutsummaryrefslogtreecommitdiff
path: root/ui/src/format.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/format.rs')
-rw-r--r--ui/src/format.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/ui/src/format.rs b/ui/src/format.rs
index 811211a..01982af 100644
--- a/ui/src/format.rs
+++ b/ui/src/format.rs
@@ -13,12 +13,12 @@ use crate::locale::tr;
use std::fmt::Write;
pub fn format_duration(d: f64) -> String {
- format_duration_mode(d, false, LANG_ENG.0)
+ format_duration_mode(LANG_ENG.0, d, false)
}
-pub fn format_duration_long(d: f64, lang: Language) -> String {
- format_duration_mode(d, true, lang)
+pub fn format_duration_long(lang: Language, d: f64) -> String {
+ format_duration_mode(lang, d, true)
}
-fn format_duration_mode(mut d: f64, long_units: bool, lang: Language) -> String {
+fn format_duration_mode(lang: Language, mut d: f64, long_units: bool) -> String {
let mut s = String::new();
let sign = if d > 0. { "" } else { "-" };
d = d.abs();
@@ -58,15 +58,15 @@ fn test_duration_short() {
#[test]
fn test_duration_long() {
assert_eq!(
- format_duration_long(61., LANG_ENG.0).as_str(),
+ format_duration_long(LANG_ENG.0, 61.).as_str(),
"1 minute and 1 second"
);
assert_eq!(
- format_duration_long(121., LANG_ENG.0).as_str(),
+ format_duration_long(LANG_ENG.0, 121.).as_str(),
"2 minutes and 1 second"
);
assert_eq!(
- format_duration_long(3661., LANG_ENG.0).as_str(),
+ format_duration_long(LANG_ENG.0, 3661.).as_str(),
"1 hour, 1 minute and 1 second"
);
}