[Zope3-dev] Can we remove ZopeLegacy for now?
Phillip J. Eby
pje@telecommunity.com
Sat, 16 Mar 2002 19:20:28 -0500
At 06:00 PM 3/16/02 -0500, Tim Peters wrote:
>OK, what's the intent? The page says
>
> tz.tzoffset(dt) - given a datetime object, returns the timezone
> offset in seconds east of UTC (negative west of UTC) corresponding
> to that date and time
>
>I expect the docs don't mean what they appear to say, or are leaving too
>much unsaid. "That date and time" doesn't *mean* anything concrete unless
>you tell me the time system it's measured in.
IIUC, 'dt' is to be interpreted as being in tz's time system if it is a
plain 'datetime' as opposed to a 'datetimetz'. If it is a 'datetimetz'
with a different tzinfo than 'tz', then presumably tz must convert 'dt' to
UTC or its own time system first. Since it can ask the other tzinfo object
for a UTC offset for 'dt', it provably can perform this conversion.
Of course, if 'tz' is a constant offset, then there's no need to look at
the value of 'dt' at all. :)
IMHO, for ease of conversion, it would be better if tzinfo objects
supported methods to return a datetime (or at least the datetime field
values) from a linear time value (such as Unix clock ticks), and vice versa.