[issue2736] datetime needs an "epoch" method

Alexander Belopolsky report at bugs.python.org
Thu Feb 18 23:58:04 CET 2010


Alexander Belopolsky <alexander.belopolsky at gmail.com> added the comment:

Victor,

As you explain in your own documentation, the proposed method is equivalent to ``(time.mktime(self.timetuple()), self.microsecond)``, so all it does is replacing a less than a one-liner.  Moreover, I am not sure time.mktime(self.timetuple()) is something that people would want to do with a TZ-aware datetime.  If the tzinfo of the datetime object does not match the system TZ used by mktime, the result will be quite misleading.

On the patch itself:

1. See my comment at Issue1726687 about the tm_wday == 1 typo.

2. I don't think time_t to long cast is safe on all platforms.

----------
nosy: +Alexander.Belopolsky
title: datetime needs and "epoch" method -> datetime needs an "epoch" method
type: behavior -> feature request

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2736>
_______________________________________


More information about the Python-bugs-list mailing list