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

Function get_date_from_days

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

Extracts the month and year and day number from a number of days

Source from the content-addressed store, hash-verified

194
195// Extracts the month and year and day number from a number of days
196static void get_date_from_days(int64_t days, int64_t* date_year, int64_t* date_month,
197 int64_t* date_day) {
198 int64_t *month_lengths, i;
199
200 *date_year = days_to_yearsdays(&days);
201 month_lengths = _days_per_month_table[is_leapyear(*date_year)];
202
203 for (i = 0; i < 12; ++i) {
204 if (days < month_lengths[i]) {
205 *date_month = i + 1;
206 *date_day = days + 1;
207 return;
208 } else {
209 days -= month_lengths[i];
210 }
211 }
212
213 // Should never get here
214 return;
215}
216
217// Splitting time quantities, for example splitting total seconds into
218// minutes and remaining seconds. After we run

Callers 2

PyDate_convert_intFunction · 0.85
PyDateTime_from_intFunction · 0.85

Calls 2

days_to_yearsdaysFunction · 0.85
is_leapyearFunction · 0.85

Tested by

no test coverage detected