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

Function PyDateTime_from_int

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

Source from the content-addressed store, hash-verified

300}
301
302Status PyDateTime_from_int(int64_t val, const TimeUnit::type unit, PyObject** out) {
303 int64_t hour = 0, minute = 0, second = 0, microsecond = 0;
304 RETURN_NOT_OK(PyTime_convert_int(val, unit, &hour, &minute, &second, &microsecond));
305 int64_t total_days = 0;
306 hour = split_time(hour, 24, &total_days);
307 int64_t year = 0, month = 0, day = 0;
308 get_date_from_days(total_days, &year, &month, &day);
309 *out = PyDateTime_FromDateAndTime(
310 static_cast<int32_t>(year), static_cast<int32_t>(month), static_cast<int32_t>(day),
311 static_cast<int32_t>(hour), static_cast<int32_t>(minute),
312 static_cast<int32_t>(second), static_cast<int32_t>(microsecond));
313 return Status::OK();
314}
315
316int64_t PyDate_to_days(PyDateTime_Date* pydate) {
317 return get_days_from_date(PyDateTime_GET_YEAR(pydate), PyDateTime_GET_MONTH(pydate),

Callers 1

VisitMethod · 0.85

Calls 4

PyTime_convert_intFunction · 0.85
split_timeFunction · 0.85
get_date_from_daysFunction · 0.85
OKFunction · 0.50

Tested by

no test coverage detected