Ignore:
Timestamp:
10/04/06 03:42:50 (8 years ago)
Author:
xi
Message:

Fix loss of microsecond precision in datetime.datetime constructor (fix #30).
Thanks to edemaine@… for the bug report and the patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/lib/yaml/constructor.py

    r225 r234  
    301301                :(?P<minute>[0-9][0-9]) 
    302302                :(?P<second>[0-9][0-9]) 
    303                 (?:(?P<fraction>\.[0-9]*))? 
     303                (?:\.(?P<fraction>[0-9]*))? 
    304304                (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?) 
    305305                (?::(?P<tz_minute>[0-9][0-9]))?))?)?$''', re.X) 
     
    319319        fraction = 0 
    320320        if values['fraction']: 
    321             fraction = int(float(values['fraction'])*1000000) 
     321            fraction = int(values['fraction'][:6].ljust(6, '0')) 
    322322        delta = None 
    323323        if values['tz_sign']: 
Note: See TracChangeset for help on using the changeset viewer.