示例#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));
}
示例#2
0
文件: dt_length.c 项目: chansen/c-dt
int
dt_length_of_year(dt_t dt) {
    int y;
    dt_to_yd(dt, &y, NULL);
    return dt_days_in_year(y);
}
示例#3
0
文件: dt_navigate.c 项目: ifzz/c-dt
dt_t
dt_end_of_year(dt_t dt, int offset) {
    int y;
    dt_to_yd(dt, &y, NULL);
    return dt_from_yd(y + offset + 1, 0);
}
示例#4
0
文件: dt_navigate.c 项目: ifzz/c-dt
dt_t
dt_start_of_year(dt_t dt, int offset) {
    int y;
    dt_to_yd(dt, &y, NULL);
    return dt_from_yd(y + offset, 1);
}