Avoid unneeded use of wxLocale in wxDateTime::Format()
On OS X, wxDateTime::Format() uses wxString::Replace() to unconditionally replace locale-specific %c, %x and %X specifiers in the format string if present. Doing so causes three wxLocale::GetInfo() calls that are often not necessary. Check for the presence of these specifiers before calling GetInfo(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -316,9 +316,12 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
|
|||||||
|
|
||||||
wxString format = formatp;
|
wxString format = formatp;
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
format.Replace("%c",wxLocale::GetInfo(wxLOCALE_DATE_TIME_FMT));
|
if ( format.Contains("%c") )
|
||||||
format.Replace("%x",wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT));
|
format.Replace("%c", wxLocale::GetInfo(wxLOCALE_DATE_TIME_FMT));
|
||||||
format.Replace("%X",wxLocale::GetInfo(wxLOCALE_TIME_FMT));
|
if ( format.Contains("%x") )
|
||||||
|
format.Replace("%x", wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT));
|
||||||
|
if ( format.Contains("%X") )
|
||||||
|
format.Replace("%X", wxLocale::GetInfo(wxLOCALE_TIME_FMT));
|
||||||
#endif
|
#endif
|
||||||
// we have to use our own implementation if the date is out of range of
|
// we have to use our own implementation if the date is out of range of
|
||||||
// strftime()
|
// strftime()
|
||||||
|
Reference in New Issue
Block a user