[Python-Dev] Issue 2736: datetimes and Unix timestamps

Guido van Rossum guido at python.org
Mon Jun 4 23:25:34 CEST 2012


On Mon, Jun 4, 2012 at 1:57 PM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
> On Mon, Jun 4, 2012 at 3:05 PM, Guido van Rossum <guido at python.org> wrote:
>> You seem to have misread -- I don't want to check if they are exactly
>> 24 hours apart. I want to check if they are at most 24 hours apart.
>> The timezone can be assumed to be the same on dt1 and dt2.
>>
>> A variant of (1) was what was needed -- the user had just confused
>> themselves into thinking they needed to convert to UTC first, and done
>> a poor job of that. This is a common situation.
>
> It looks like if we had datetime.ticks() method, the user would simply
> use it improperly and never ask his or her question.  Hardly the
> result that we want.

That's not my assessment of the situation.

But I don't know what ticks() is supposed to do. I am assuming we
would create totimestamp() and utctotimestamp() that mirror
fromtimestamp() and utcfromtimestamp(). Since we trust the user with
the latter we should trust them with the former.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list