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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/YMD.pmod:2480:   //! <ref>Ruleset.set_abbr2zone</ref>.         // dwim time of day; needed to correct timezones   // this API may change without further notice   static TimeRange dwim_tod(TimeRange origin,string whut,int h,int m,int s)   {    TimeRange tr;    if (catch {    tr=origin[whut](h,m,s); -  } && h==24 && m==0 && s==0) // special case +  }) +  if (h==24 && m==0 && s==0) // special case    return origin->end()->second(); -  +  else +  { +  object d=origin->day(); +  array(cHour) ha=origin->hours(); +  int n=search(ha->hour_no(),h); +  if (n!=-1) tr=ha[n]->minute(m)->second(s); +  else return 0; // no such hour +  }       if (tr->hour_no()!=h || tr->minute_no()!=m)    {   // werror("%O %O %O -> %O %O %O (%O)\n",   // tr->hour_no(),tr->minute_no(),tr->second_no(),   // h,m,s,tr);    if (tr->hour_no()!=h)    tr=tr->add(h-tr->hour_no(),Hour);    if (tr->minute_no()!=m)    tr=tr->add(m-tr->minute_no(),Minute);