[egenix-users] mx.DateTime.now()accuracy

M.-A. Lemburg mal at egenix.com
Tue Feb 10 18:00:19 CET 2009


On 2009-02-10 17:41, egenix at jf-gosset.com wrote:
> Hi,
> 
> That's on Windows platform (tested with 2.5.1 and 2.5.4 versions of python).

In mxDateTime 3.x we're using a more direct way of getting the
current time which is faster. Apparently, on Windows this doesn't
provide the full accuracy anymore.

We'll add a fix for this to the next eGenix mx Base release.

As work-around you can comment out the following line in egenix_mx_base.py
of the distribution to have mxDateTime use the 2.x strategy again:

                 #define_macros=[('USE_FAST_GETCURRENTTIME', None)],

Some more context:

    mx_Extension('mx.DateTime.mxDateTime.mxDateTime',
                 ['mx/DateTime/mxDateTime/mxDateTime.c'],
                 # If mxDateTime doesn't compile, try removing the next line.
                 #define_macros=[('USE_FAST_GETCURRENTTIME', None)],
                 #
                 include_dirs=['mx/DateTime/mxDateTime'],
                 optional_libraries=_mxDateTime_optional_libraries,
                 ),

You'll then have to recompile the package using

python setup.py bdist_msi

and install the generated MSI file.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 10 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/ 
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/

> Thank's
> jf
> 
> Message d'origine (10/02/2009 17:29) émis par (M.-A. Lemburg) :
>> On 2009-02-10 17:17, egenix at jf-gosset.com wrote:
>>> With the old 2.0.3 version of mx.DateTime, now() returned fraction of seconds so we had 1/100sec accuracy.
>>> With 3.1.2 version, now() now [!] returns whole integer numbers.
>>>
>>> Tested with same version of Python (2.5.4). Just switched mx... package in site-packages 
>>>
>>> Is it by design or is it a bug? 
>> On which platform are you seeing this problem ?
>>
>> mxDateTime does return fractions on Linux:
>>
>>>>> from mx.DateTime import now
>>>>> now()
>> <mx.DateTime.DateTime object for '2009-02-10 17:26:11.86' at 2b13fe0e78c8>
>>
>> -- 
>> Marc-Andre Lemburg
>> eGenix.com
>>
>> Professional Python Services directly from the Source  (#1, Feb 10 2009)
>>>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
>> ________________________________________________________________________
>>
>> ::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
>>
>>
>>   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>>    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>>           Registered at Amtsgericht Duesseldorf: HRB 46611
>>               http://www.egenix.com/company/contact/ 
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> https://www.egenix.com/mailman/listinfo/egenix-users



More information about the egenix-users mailing list