Tim Peters <[EMAIL PROTECTED]> added the comment:

Not a bug.  Try (future - now).seconds instead so that the timedelta is
positive.  As explained in the docs, a negative timedelta is normalized
so that only the .days attribute is negative, and, as the docs also say,
"normalization of negative values may be surprising at first".  The
.seconds and .microseconds attributes are always non-negative.

>>> from datetime import datetime
>>> now = datetime.today()
>>> future = datetime.today()
>>> (now - future).seconds
86390
>>> (future - now).seconds
9
>>> now - future
datetime.timedelta(-1, 86390, 146000) # only .days is negative

----------
nosy: +tim_one

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3893>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to