Velko Ivanov <viva...@ivanov-nest.com> added the comment:

On 04/05/2011 18:22, Alexander Belopolsky wrote:
> """
> The datetime module intended to be an island of relative sanity.
> ....... """ - Tim Peters

Refusing to cooperate with the rest of the world is not sane by my books.

On 04/05/2011 21:06, Alexander Belopolsky wrote:
> Converting datetime values to float is easy.   If your dt is a naive instance 
> representing UTC time:
>
>     timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)
>
> If your dt is an aware instance:
>
>     timestamp = (dt - datetime(1970, 1, 1, tzinfo=timezone.utc)) / 
> timedelta(seconds=1)

Please add these lines to the datetime module's documentation. In some 
central, well lit place. I believe that if nothing else, the whole 
discussion should have proved to you that there are many people looking 
for them.

OTOH a sinceepoch(epoch=datetime(1970,1,1)) method of the datetime class 
should be equally easy. Would be especially useful if few of the more 
frequently used EPOCHs are provided as constants.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to