This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author frankmillman
Recipients frankmillman
Date 2012-05-04.06:31:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336113066.83.0.671734474285.issue14720@psf.upfronthosting.co.za>
In-reply-to
Content
sqlite3/dbapi2.py contains the following - 

    def convert_timestamp(val): 
        datepart, timepart = val.split(b" ")
        timepart_full = timepart.split(b".")
        [...] 
        if len(timepart_full) == 2: 
            microseconds = int(timepart_full[1]) 
        else: 
            microseconds = 0 

It assumes that 'timepart_full[1]' is a string containing 6 digits. 

I have a situation where the string containing 3 digits, so it gives the wrong result. For example, if the string is '456', this represents 456000 microseconds, but sqlite3 returns 456 microseconds.

I think that it should right-zero-fill the string to 6 digits before converting to an int, like this - 

    microseconds = int('{:0<6}'.format(timepart_full[1]))
History
Date User Action Args
2012-05-04 06:31:06frankmillmansetrecipients: + frankmillman
2012-05-04 06:31:06frankmillmansetmessageid: <1336113066.83.0.671734474285.issue14720@psf.upfronthosting.co.za>
2012-05-04 06:31:01frankmillmanlinkissue14720 messages
2012-05-04 06:31:01frankmillmancreate