Extracts the month and year and day number from a number of days
| 194 | |
| 195 | // Extracts the month and year and day number from a number of days |
| 196 | static 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 |
no test coverage detected