[Zope3-dev] Re: [Python-Dev] Holes in time

Aahz aahz@pythoncraft.com
Fri, 3 Jan 2003 18:41:31 -0500


On Fri, Jan 03, 2003, Tim Peters wrote:
> [Aahz]
>> 
>> What *does* the current implementation do when it hits the witching
>> hour of DST->ST?
> 
> Please read the original msg again.  Nothing that followed has been of
> much help, and I've really had nothing new to say since then -- it was
> all there at the start (including the answer to this question).

Your love of mathematical precision sometimes gets in the way of clear
answers to specific questions.  ;-)  (Yes, I saw the bit about ValueError
earlier, but it was implied, not explicit.)

>> So far, I've been saying that it should return 1:MM twice when converting
>> from UTC; if it already does that, I'm fine.
> 
> It doesn't now, but I believe it will be reasonably cheap to do so,
> and that's what Guido wants it to do too.  Provided that's the defined
> and documented behavior, fine by me too.  Thanks for pushing for it!
> (Right or wrong, it fosters the illusion of consensus <wink>.)

Cool!  

>> The only case where I've advocated raising an exception was attempting
>> to convert a pure wall clock time to any timezone-based time.
> 
> The datetime module doesn't have a class named "PureWallClockTime"
> <wink>.  Seriously, the original msg posed focused questions about
> how a specific class method should act in its debatable endcases, and
> anything beyond that is out-of-scope for me here.

Uh, it sure looks to me like timetz defaults tzinfo to None, which I'd
call "pure wall clock".  But you're probably right that it's out-of-scope
for this discussion -- I only brought it up because you mentioned Guido's
calendar.  (Nevertheless, I can't resist continuing the argument below.)

>> (As in the case of Guido's calendar entries.)  That would raise an
>> exception for all times, not just DST change days.
> 
> Under the agreement, Guido's calendar entries will display as 1:MM in
> this case, if a programmer uses datetimetz.astimezone() to convert
> them.  ...

No, they shouldn't, assuming Guido's calendar entries are built out of
timetz instances with tzinfo set to None.  Remember that Guido sticks in
entries for 1pm in SF while he's still in DC.  If you're going to handle
this use case, there needs to be a way to spell it, and someone trying
to convert this to a timezone ought to get an exception.
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"There are three kinds of lies: Lies, Damn Lies, and Statistics."  --Disraeli