You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2022/08/15 08:38:39 UTC
[arrow-rs] branch master updated: Simplify function (#2436)
This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 76e79d9fb Simplify function (#2436)
76e79d9fb is described below
commit 76e79d9fbe77d9669e59c24d501ea990f908c8e7
Author: Liang-Chi Hsieh <vi...@gmail.com>
AuthorDate: Mon Aug 15 01:38:35 2022 -0700
Simplify function (#2436)
---
arrow/src/temporal_conversions.rs | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/arrow/src/temporal_conversions.rs b/arrow/src/temporal_conversions.rs
index 12982b7da..14fa82f6e 100644
--- a/arrow/src/temporal_conversions.rs
+++ b/arrow/src/temporal_conversions.rs
@@ -138,22 +138,9 @@ pub fn timestamp_ns_to_datetime(v: i64) -> NaiveDateTime {
)
}
-///
#[inline]
pub(crate) fn split_second(v: i64, base: i64) -> (i64, u32) {
- if v < 0 {
- let v = -v;
- let mut seconds = v / base;
- let mut part = v % base;
-
- if part > 0 {
- seconds += 1;
- part = base - part;
- }
- (-seconds, part as u32)
- } else {
- (v / base, (v % base) as u32)
- }
+ (v.div_euclid(base), v.rem_euclid(base) as u32)
}
/// converts a `i64` representing a `duration(s)` to [`Duration`]