Petri Lehtinen added the comment: Serhiy Storchaka wrote: > convert_timestamp() can silently return wrong result if seconds > saved with more than millisecond precision (i.e. '2012-04-04 > 15:06:00.000123456'). I propose or truncate fractional part to 6 > digits ('{:0<6.6}') or explicitly raise an exception if > len(timepart_full[1]) > 6.
That's a good point. Also, '2012-04-04 15:06:00.1234567' fails with a ValueError when executing the SELECT statement, because the microsecond part is not in range 0-999999. Truncating the fractional part to 6 characters sounds good to me, because that way we get the best possible precision without failing abruptly. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14720> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com