Dave Rolsky schreef:
> On Thu, 3 Apr 2003, Eugene van der Pijll wrote:
> > And this works. But even more people will use DateTime->now. And then
> > a floating time would be wrong.
> 
> Why would a floating time be wrong then?

(I think I meant to say 'a utc time', as now() returns a 'utc' time.
However, when converting it to other calendars, utc and floating work
identically.)

now() doesn't always return today's (local) date. If you want that, you
need the time_zone. Calendars that are tz aware, also show the correct
(local) date. Calendars that do not know about time and time zones, show
the utc date.

> > As an example, the first program I wrote using
> > DateTime::Calendar::Mayan.
> >
> >     use DateTime;
> >     my $d = DateTime->now;
> >     $d->set_time_zone( 'Europe/Amsterdam' );
> >     $d->set_time_zone( 'floating' );
> >     print $d->strftime("%A %d %B %Y\n");
> 
> Can you show the output and explain the problems?  Honestly, I have no
> clue what this _should_ print.

It shows the correct output, because of the workaround (two calls to
set_time_zone). If you remove the second one (to 'floating'), you'll see
that the output of the last two calendars can be inconsistent with the
output of the first two.

(Try an offset of '+1200' or '-1200' in the first call to time_zone, and
compare with the always correct ouput in timezone 'utc' to see the
problem more clearly. At this moment:

UTC: it's Thursday 03 April 2003
Thursday 21 March 2003 Julian
Jeudi 12 Clinamen 130 [St Georges Dazet, poulpe au regard de soie]
12,19,10,2,10

+1200: it's Friday 04 April 2003
Friday 22 March 2003 Julian
Jeudi 12 Clinamen 130 [St Georges Dazet, poulpe au regard de soie]
12,19,10,2,10

The first two are correct. The last two do not implement times, and are
wrong.)

Apologies for the unclearness. But it's already late, here in +0200.

Eugene

Reply via email to