[egenix-users] mxDateTime calculation error

M.-A. Lemburg mal at egenix.com
Mon Jan 3 14:47:10 CET 2005


Jäckle Thomas wrote:
> Hello!
> 
> I found an error when executing following Python script:
> 
> import mx.DateTime
> date = mx.DateTime.DateTime(2005, 1, 2, 12, 42, 27.64)
> print date
> date = date - 0
> print date
> 
> The result should be:
> 2005-01-02 12:42:27.64
> 2005-01-02 12:42:27.63
> 
> So the subtraction of 0 seems to change the time! This reduction of 1/100
> second happens not always but only with several numbers (like 27.64s in
> above example).
> This subtraction happens for example at the end of the DateTimeFrom()
> function (where on offset of 0 is subtracted), so I can't work around it.
> 
> Is this bug known? Is there any solution?

This sounds like a bug on the platform you are using or
with the compiler.

Which version of egenix-mx-base are you using ? Testing with
the latest snapshot of egenix-mx-base, I don't get this output:

 >>> import mx.DateTime
 >>> date = mx.DateTime.DateTime(2005, 1, 2, 12, 42, 27.64)
 >>> print date
2005-01-02 12:42:27.64
 >>> print date + 0
2005-01-02 12:42:27.64
 >>> print date - 0
2005-01-02 12:42:27.64

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 03 2005)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2004-12-06: Released eGenix mx Extensions for Python 2.4

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list