Tim Allwine schreef: > I was wondering if you would consider making a fundamental > addition to DateTime. It would be to add the 'quarter' and > 'day_of_quarter' to DateTime.
AAAAAAAARGH! Please no! 'week' and 'day_of_year' were two of the hardest methods to write in DT::C::Christian, and now you want to add more of that kind! But now seriously: (in _rd2ymd:) > PUSHs(sv_2mortal(newSViv(y))); > PUSHs(sv_2mortal(newSViv(m))); > PUSHs(sv_2mortal(newSViv(d))); > + PUSHs(sv_2mortal(newSViv(quarter))); > > if (extra) { > dow = ((rd_days + 6) % 7) + 1; .. > PUSHs(sv_2mortal(newSViv(doy))); > + PUSHs(sv_2mortal(newSViv(doq))); > } Even though _rd2ymd is an internal function, please don't change the return values. Put 'quarter' at the end. It doesn't need to be set for all datetime's, so it's OK if it's inside the if(extra){}. Like week and doy, it's a superfluous variable: y, m, and d are sufficient to define a date. > + @{ $self->{local_c} }{ qw( year month day quarter day_of_week day_of_year > day_of_quarter) } = So this becomes > + @{ $self->{local_c} }{ qw( year month day day_of_week day_of_year quarter > day_of_quarter) } = Eugene