Ejemplo n.º 1
0
static moment_t
THX_moment_with_day_of_year(pTHX_ const moment_t *mt, IV v) {
    int y;

    dt_to_yd(moment_local_dt(mt), &y, NULL);
    if (v < 1 || v > 365) {
        int diy = dt_days_in_year(y);
        if (v < 1 || v > diy)
            croak("Parameter 'day' is out of the range [1, %d]", diy);
    }
    return THX_moment_with_local_dt(aTHX_ mt, dt_from_yd(y, (int)v));
}
Ejemplo n.º 2
0
bool
dt_valid_yd(int y, int d) {
    return (d >= 1 && (d <= 365 || d == dt_days_in_year(y)));
}
Ejemplo n.º 3
0
int
dt_length_of_year(dt_t dt) {
    int y;
    dt_to_yd(dt, &y, NULL);
    return dt_days_in_year(y);
}