Skip to content

Commit 998e5e6

Browse files
committed
refactor: use float div&ceil to avoid unstable features
1 parent 17eb99b commit 998e5e6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/common/time/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(int_roundings)]
21
// Copyright 2023 Greptime Team
32
//
43
// Licensed under the Apache License, Version 2.0 (the "License");

src/common/time/src/timestamp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ impl Timestamp {
143143
Some(Timestamp::new(value, unit))
144144
} else {
145145
let mul = unit.factor() / self.unit().factor();
146-
Some(Timestamp::new(self.value.div_ceil(mul as i64), unit))
146+
let new_ts = self.value as f64 / mul as f64;
147+
Some(Timestamp::new(new_ts.ceil() as i64, unit))
147148
}
148149
}
149150

0 commit comments

Comments
 (0)