R> In March Vadim Zeitlin posted a patch to support milliseconds in
R> ParseFormat with %l specifier. That works most of the time, but not
R> when the milliseconds are zero. Example:
R>
R> datetime.ParseFormat("12:23:45.123", "%H:%M:%S.%l") works, but
R>
R> datetime.ParseFormat("12:23:45.000", "%H:%M:%S.%l") works not.
R>
R> Ist this a bug or am i doing something wrong?
This would, of course, be a bug but I don't see it: the tests added by
this patch
Index: tests/datetime/datetimetest.cpp
===================================================================
--- tests/datetime/datetimetest.cpp (revision 61484)
+++ tests/datetime/datetimetest.cpp (working copy)
@@ -786,6 +786,14 @@
CPPUNIT_ASSERT_EQUAL( 1856, dt.GetYear() );
#endif
+ // also test %l separately
+ CPPUNIT_ASSERT( dt.ParseFormat("12:23:45.678", "%H:%M:%S.%l") );
+ CPPUNIT_ASSERT_EQUAL( 678, dt.GetMillisecond() );
+
+ // test special case of %l matching 0 milliseconds
+ CPPUNIT_ASSERT( dt.ParseFormat("12:23:45.000", "%H:%M:%S.%l") );
+ CPPUNIT_ASSERT_EQUAL( 0, dt.GetMillisecond() );
+
// test partially specified dates too
wxDateTime dtDef(26, wxDateTime::Sep, 2008);
CPPUNIT_ASSERT( dt.ParseFormat("17", "%d") );
pass for me. Can you reproduce your problem in this test?
Thanks,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/