<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 43: Invalid microsecond conversion using DateTimeAsPython</title><link>https://sourceforge.net/p/python-sybase/bugs/43/</link><description>Recent changes to 43: Invalid microsecond conversion using DateTimeAsPython</description><atom:link href="https://sourceforge.net/p/python-sybase/bugs/43/feed.rss" rel="self"/><language>en</language><lastBuildDate>Tue, 08 Oct 2013 16:06:59 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/python-sybase/bugs/43/feed.rss" rel="self" type="application/rss+xml"/><item><title>Invalid microsecond conversion using DateTimeAsPython</title><link>https://sourceforge.net/p/python-sybase/bugs/43/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;When using &lt;code&gt;DateTimeAsPython&lt;/code&gt; for my output map, I found that the microsecond value in &lt;code&gt;datetime.datetime&lt;/code&gt; was 1000 times the value stored in the database. here's a patch:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="gd"&gt;--- Sybase.py   (revision xxx)&lt;/span&gt;
&lt;span class="gi"&gt;+++ Sybase.py   (working copy)&lt;/span&gt;
&lt;span class="gu"&gt;@@ -197,10 +197,10 @@&lt;/span&gt;
     DateTimeAsPython = {
         CS_DATETIME_TYPE: lambda val: datetime.datetime(val.year, val.month + 1, val.day,
                                                         val.hour, val.minute,
&lt;span class="gd"&gt;-                                                        val.second, val.msecond * 1000),&lt;/span&gt;
&lt;span class="gi"&gt;+                                                        val.second, val.msecond),&lt;/span&gt;
         CS_DATETIME4_TYPE: lambda val: datetime.datetime(val.year, val.month + 1, val.day,
                                                          val.hour, val.minute,
&lt;span class="gd"&gt;-                                                         val.second, val.msecond * 1000) }&lt;/span&gt;
&lt;span class="gi"&gt;+                                                         val.second, val.msecond) }&lt;/span&gt;
     if _have_cs_date_type:
         DateTimeAsPython.update({
             CS_DATE_TYPE: lambda val: datetime.date(val.year, val.month + 1, val.day) })
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Additional note: &lt;code&gt;DateTimeAsPython&lt;/code&gt; also raises an error if the datetime field is NULL, probably not the desired behavior.&lt;/p&gt;&lt;/div&gt;</description><pubDate>Tue, 08 Oct 2013 16:06:59 -0000</pubDate><guid>https://sourceforge.netf61badab7adf4a3a45ae4ce3644da523079aa584</guid></item></channel></rss>