Zefram schreef:
> Eugene van der Pijll wrote:
> >"Datetime" just means one point in time; it is not something that is
> >observed.
> 
> Yes.  An offset (plus short name and DST flag) is observed.
> The "_for_datetime" bit indicates the argument format, just like
> "offset_for_datetime".

I understand the names now. Still, I don't like them; I don't like it
either that there are three functions; even though I understand the
logic.

So: perhaps it would be better to create a single method, returning a
DateTime::Span object? And then make iterating methods that accept these
spans:

  $obs   = $tz->observance( $dt );
  $start = $obs->start;
  $end   = $obs->end;

  $prev_obs = $tz->prev_observance( $obs );
  $next_obs = $tz->next_observance( $obs );

  $prev_observance_start = $prev_obs->start;
  # Etcetera.

I think this is cleaner than your three functions; and it is even more
difficult to make mistakes here on DST boundaries.

Only problem is that DT::TimeZone would have a dependency on DT::Span
now.

Eugene

Reply via email to