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

Function PyTime_convert_int

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

Source from the content-addressed store, hash-verified

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,
237 int64_t* microsecond) {
238 switch (unit) {
239 case TimeUnit::NANO:
240 if (val % 1000 != 0) {
241 return Status::Invalid("Value ", val, " has non-zero nanoseconds");
242 }
243 val /= 1000;
244 // fall through
245 case TimeUnit::MICRO:
246 *microsecond = split_time(val, 1000000LL, &val);
247 *second = split_time(val, 60, &val);
248 *minute = split_time(val, 60, hour);
249 break;
250 case TimeUnit::MILLI:
251 *microsecond = split_time(val, 1000, &val) * 1000;
252 // fall through
253 case TimeUnit::SECOND:
254 *second = split_time(val, 60, &val);
255 *minute = split_time(val, 60, hour);
256 break;
257 default:
258 break;
259 }
260 return Status::OK();
261}
262
263static inline Status PyDate_convert_int(int64_t val, const DateUnit unit, int64_t* year,
264 int64_t* month, int64_t* day) {

Callers 2

PyTime_from_intFunction · 0.85
PyDateTime_from_intFunction · 0.85

Calls 3

split_timeFunction · 0.85
InvalidFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected