Skip to content

Commit 55fa142

Browse files
committed
chore: simplify
1 parent 916f4dc commit 55fa142

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rust/cubesql/pg-srv/src/values/interval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ impl IntervalValue {
3636
}
3737

3838
pub fn extract_years_month(&self) -> (i32, i32) {
39-
let years = (self.months as f64 / 12_f64).floor();
40-
let month = self.months as f64 - (years * 12_f64);
39+
let years = self.months / 12;
40+
let month = self.months % 12;
4141

42-
(years as i32, month as i32)
42+
(years, month)
4343
}
4444

4545
pub fn as_iso_str(&self) -> String {

0 commit comments

Comments
 (0)