[egenix-users] Roundoff problem in DateTime

Reggie Dugard reggie at merfinllc.com
Mon Jul 8 12:36:48 CEST 2002


I downloaded and compiled the beta 2 version of 2.1.0 and unfortunately
it didn't help.  I've printed out all the attributes below, as you
requested.

Let me know if you need anything else.

Reggie


Python 2.2.1 (#1, Apr 29 2002, 15:21:53) 
[GCC 3.0.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mx.DateTime
>>> mx.DateTime.__version__
'2.1.0'
>>> t = mx.DateTime.DateTimeFromAbsDateTime(730488,81317.647058823524)
>>> t
<DateTime object for '2001-01-03 22:35:17.65' at 8134e58>
>>> t + 1.0/17.0
<DateTime object for '2001-01-03 24:00:00.00' at 8167600>
>>> for attr in t.__members__:
...     print attr, ':', getattr(t,attr)
... 
year : 2001
month : 1
day : 3
hour : 22
minute : 35
second : 17.6470588235
absdays : 730487.941176
absdate : 730488
abstime : 81317.6470588
yearoffset : 730485
is_leapyear : 0
day_of_week : 2
day_of_year : 3
days_in_month : 31
tz : PST
dst : 0
iso_week : (2001, 1, 3)
mjd : 51912.9411765
tjd : 1912.94117647
tjd_myriad : 245
jdn : 2451913.44118
calendar : Gregorian
>>> 

On Mon, 2002-07-08 at 01:33, M.-A. Lemburg wrote:
> Reggie Dugard wrote:
> > I'm using what I believe to be the latest version of mx.DateTime (2.0.3)
> > and I seem to have discovered a roundoff problem.  The problem occurs on
> > Redhat 7.1, but not under Windows 2000 SP2.  Both are running the same
> > versions of python and mx.DateTime.
> > 
> > After performing a floating point addition, I'm getting a time of
> > 24:00:00 instead of getting 00:00:00 for the next day.  The release
> > notes mention a similar problem and seem to indicate that it has already
> > been addressed.  I'm able to consistently reproduce this my problem with
> > the simple example below.
> > 
> > So, I was wondering if anyone else has this problem or if there is a
> > patch/known workaround for it.
> 
> Could you check whether the problem still persists with the
> latest egenix-mx-base beta 2 ? (see the mailing list archives
> for all the URLs)
> 
> > Reggie Dugard
> > Merfin, LLC
> > 
> > $ uname -a
> > Linux auk 2.4.9-34 #1 Sat Jun 1 06:10:23 EDT 2002 i686 unknown
> > $ python
> > Python 2.2.1 (#1, Apr 29 2002, 15:21:53) 
> > [GCC 3.0.3] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > 
> >>>>import mx.DateTime
> >>>>mx.DateTime.__version__
> >>>
> > '2.0.3'
> > 
> >>>>t = mx.DateTime.DateTimeFromAbsDateTime(730488, 81317.647058823524)
> >>>>t
> >>>
> > <DateTime object for '2001-01-03 22:35:17.64' at 8134e20>
> > 
> >>>>t + 1.0/17.0
> >>>
> > <DateTime object for '2001-01-03 24:00:00.00' at 8166700>
> 
> Could you provide a printout of the values of all attributes
> this instance has (both on Windows and Linux) ?
> 
> t = ...
> for attr in t.__members__:
>      print attr, ':', getattr(t, attr)
> 
> Thanks,
> -- 
> Marc-Andre Lemburg
> CEO eGenix.com Software GmbH
> _______________________________________________________________________
> eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
> Python Consulting:                               http://www.egenix.com/
> Python Software:                    http://www.egenix.com/files/python/
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> http://lists.egenix.com/mailman/listinfo/egenix-users





More information about the egenix-users mailing list