From 645706a24e10dd3c5db9063a53887ec52413c632 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 7 Mar 2009 19:36:59 +0000 Subject: [PATCH] support %l in wxDateTime::ParseFormat() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59421 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/common/datetime.cpp | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d90c86629a..089db7270a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -374,6 +374,7 @@ All: - Added wxProtocolLog and use it in wxFTP. - Added wxXmlResource::GetResourceNode(). - Optimize wxString::Replace() to use an O(N) algorithm (Kuang-che Wu). +- Added support of %l format specifier to wxDateTime::ParseFormat(). All (Unix): diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index 1547b4a14e..2474382dba 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -3186,13 +3186,15 @@ wxDateTime::ParseFormat(const wxString& date, haveYear = false, haveHour = false, haveMin = false, - haveSec = false; + haveSec = false, + haveMsec = false; bool hourIsIn12hFormat = false, // or in 24h one? isPM = false; // AM by default // and the value of the items we have (init them to get rid of warnings) - wxDateTime_t sec = 0, + wxDateTime_t msec = 0, + sec = 0, min = 0, hour = 0; WeekDay wday = Inv_WeekDay; @@ -3376,6 +3378,14 @@ wxDateTime::ParseFormat(const wxString& date, yday = (wxDateTime_t)num; break; + case _T('l'): // milliseconds (0-999) + if ( !GetNumericToken(width, input, &num) ) + return NULL; + + haveMsec = true; + msec = (wxDateTime_t)num; + break; + case _T('m'): // month as a number (01-12) if ( !GetNumericToken(width, input, &num) || !num || (num > 12) ) { @@ -3757,6 +3767,9 @@ wxDateTime::ParseFormat(const wxString& date, tm.sec = sec; } + if ( haveMsec ) + tm.msec = msec; + Set(tm); // finally check that the week day is consistent -- if we had it -- 2.45.2