pike.git / lib / modules / Calendar.pmod / YMD.pmod

version» Context lines:

pike.git/lib/modules/Calendar.pmod/YMD.pmod:1185:    return Day("ymd_yd",rules,y,yjd,yjd+yd-1,yd,what->n);    }       if (what->is_week)    {    cWeek week=Week("ymd_yw",rules,y,what->w,what->n);    if (!force && week->y!=y) return 0; // not this year    return week;    }    +  if (what->is_year) +  return Year("ymd_yn",rules,y,what->number_of_years()); +  +  if (what->is_month) +  return month(what->month_name()); +  +  if (what->is_timeofday) +  return place(what->day(),force)->place(what,force); +     error("place: Incompatible type %O\n",what);    }       TimeRange distance(TimeRange to)    {    if (to->is_timeofday)    {    return hour()->distance(to);    }    if (to->is_ymd)
pike.git/lib/modules/Calendar.pmod/YMD.pmod:1495:    }       TimeRange place(TimeRange what,void|int force)    {    if (what->is_year)    return year()->place(what,force); // just fallback       if (what->is_day)    return place_day(what->month_day(),what->n,force);    +  if (what->is_month) +  return Month("ymd_ym",rules,y,m,what->number_of_months()) +  ->autopromote(); +  +  if (what->is_week) +  return place(what->day(),force)->week(); +  +  if (what->is_timeofday) +  return place(what->day(),force)->place(what,force); +     error("place: Incompatible type %O\n",what);    }      // --- Month to other units       int number_of_years()    {    if (n<=1) return 1;       [int y2,int m2,int nd2,int yd2]=year_month_from_month(y,m+n);
pike.git/lib/modules/Calendar.pmod/YMD.pmod:1793:    }       TimeRange place(TimeRange what,void|int force)    {    if (what->is_supertimerange)    return what->mend_overlap(map(what->parts,place,force));   // return `|(@map(what->parts,place,force));       if (what->is_year)    return year()->place(what,force); // just fallback +  if (what->is_month) +  return month()->place(what,force); // just fallback    -  +  if (what->is_week) +  return Week("ymd_yw",rules,y,w,what->number_of_weeks()); +     if (what->is_day)    return place_day(what->week_day(),what->n,force);       if (what->is_timeofday)    return place(what->day(),force)->place(what,force);       error("place: Incompatible type %O\n",what);    }      // --- Week to other units
pike.git/lib/modules/Calendar.pmod/YMD.pmod:2098:    if (step->is_week)    return week()->add(x,step)->place(this_object(),1);       if (step->is_day)    return Day("ymd_jd",rules,jd+x*step->n,n)    ->autopromote();       error("_move: Incompatible type %O\n",step);    }    -  TimeRange place(TimeRange what) +  TimeRange place(TimeRange what,int|void force)    {    if (what->is_timeofday)    {    int lux=    what->ux-    Day("unix_r",what->unix_time(),what->ruleset())    ->unix_time();       if (what->is_timeofday_f)    return    Fraction("timeofday_f",rules,    lux+unix_time(),what->ns,what->s_len,what->ns_len)    ->autopromote();       return Second("timeofday",rules,unix_time()+lux,what->len)    ->autopromote();    }    -  +  if (what->is_year) +  return year()->place(what,force); // just fallback +  if (what->is_month) +  return month()->place(what,force); // just fallback +  if (what->is_week) +  return week()->place(what,force); // just fallback +  +  if (what->is_day) +  return Day("ymd_jd",rules,jd,what->number_of_days()) +  ->autopromote(); +     error("place: Incompatible type %O\n",what);    }       TimeRange distance(TimeRange to)    {    if (to->is_timeofday)    return hour()->distance(to);    if (to->is_ymd)    {    int d1=jd;