MCPcopy Create free account
hub / github.com/apache/arrow / split_time

Function split_time

python/pyarrow/src/arrow/python/datetime.cc:224–233  ·  view source on GitHub ↗

Splitting time quantities, for example splitting total seconds into minutes and remaining seconds. After we run int64_t remaining = split_time(total, quotient, &next) we have total = next * quotient + remaining. Handles negative values by propagating them: If total is negative, next will be negative and remaining will always be non-negative.

Source from the content-addressed store, hash-verified

222// them: If total is negative, next will be negative and remaining will
223// always be non-negative.
224static inline int64_t split_time(int64_t total, int64_t quotient, int64_t* next) {
225 int64_t r = total % quotient;
226 if (r < 0) {
227 *next = total / quotient - 1;
228 return r + quotient;
229 } else {
230 *next = total / quotient;
231 return r;
232 }
233}
234
235static inline Status PyTime_convert_int(int64_t val, const TimeUnit::type unit,
236 int64_t* hour, int64_t* minute, int64_t* second,

Callers 3

PyTime_convert_intFunction · 0.85
PyDateTime_from_intFunction · 0.85
PyTZInfo_utcoffset_hhmmFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected