If a locale doesn't use AM/PM strings, strftime() can return an empty string
which does not indicate an error, so don't assert that strftime() failed in
this case.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69411
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) )
{
if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) )
{
- // if the format is valid, buffer must be too small?
- wxFAIL_MSG(wxT("strftime() failed"));
+ // There is one special case in which strftime() can return 0 without
+ // indicating an error: "%p" may give empty string depending on the
+ // locale, so check for it explicitly. Apparently it's really the only
+ // exception.
+ if ( format != wxS("%p") )
+ {
+ // if the format is valid, buffer must be too small?
+ wxFAIL_MSG(wxT("strftime() failed"));
+ }