Beispiel #1
0
void
add_ordinalyears(ha_time_t * a_time, int extra)
{
    if (a_time->has->years == FALSE) {
        crm_trace("has->years == FALSE");
        return;
    }
    a_time->years += extra;
    convert_from_ordinal(a_time);
}
Beispiel #2
0
void
add_yeardays(ha_time_t * a_time, int extra)
{
    if (a_time->has->yeardays == FALSE) {
        crm_trace("has->yeardays == FALSE");
        return;
    }
    if (extra < 0) {
        sub_yeardays(a_time, -extra);
    } else {
        do_add_field(a_time, yeardays, extra,
                     (is_leap_year(a_time->years) ? 366 : 365), add_ordinalyears);
    }

    convert_from_ordinal(a_time);
}
Beispiel #3
0
void
add_yeardays(ha_time_t * a_time, int extra)
{
    if (a_time->has->yeardays == FALSE) {
        crm_trace("has->yeardays == FALSE");
        return;
    }
    if (extra < 0) {
        sub_yeardays(a_time, -extra);
    } else {
        /* coverity[result_independent_of_operands] Not interesting */
        do_add_field(a_time, yeardays, extra,
                     (is_leap_year(a_time->years) ? 366 : 365), add_ordinalyears);
    }

    convert_from_ordinal(a_time);
}
Beispiel #4
0
void
sub_yeardays(ha_time_t * a_time, int extra)
{
    if (a_time->has->yeardays == FALSE) {
        crm_trace("has->yeardays == FALSE");
        return;
    }

    crm_trace("Subtracting %d days from %.4d-%.3d", extra, a_time->years, a_time->yeardays);

    if (extra < 0) {
        add_yeardays(a_time, -extra);
    } else {
        do_sub_field(a_time, yeardays, extra,
                     is_leap_year(a_time->years) ? 366 : 365, sub_ordinalyears);
    }

    convert_from_ordinal(a_time);
}