format.Replace("%X",wxLocale::GetInfo(wxLOCALE_TIME_FMT));
#endif
// we have to use our own implementation if the date is out of range of
- // strftime() or if we use non standard specificators
+ // strftime() or if we use non standard specifiers
#ifdef wxHAS_STRFTIME
time_t time = GetTicks();
// used for calls to strftime() when we only deal with time
struct tm tmTimeOnly;
+ memset(&tmTimeOnly, 0, sizeof(tmTimeOnly));
tmTimeOnly.tm_hour = tm.hour;
tmTimeOnly.tm_min = tm.min;
tmTimeOnly.tm_sec = tm.sec;
- tmTimeOnly.tm_wday = 0;
- tmTimeOnly.tm_yday = 0;
- tmTimeOnly.tm_mday = 1; // any date will do
+ tmTimeOnly.tm_mday = 1; // any date will do, use 1976-01-01
tmTimeOnly.tm_mon = 0;
tmTimeOnly.tm_year = 76;
tmTimeOnly.tm_isdst = 0; // no DST, we adjust for tz ourselves
default:
// is it the format width?
- fmt.Empty();
- while ( *p == wxT('-') || *p == wxT('+') ||
- *p == wxT(' ') || wxIsdigit(*p) )
+ for ( fmt.clear();
+ *p == wxT('-') || *p == wxT('+') ||
+ *p == wxT(' ') || wxIsdigit(*p);
+ ++p )
{
fmt += *p;
}
}
// no, it wasn't the width
- wxFAIL_MSG(wxT("unknown format specificator"));
+ wxFAIL_MSG(wxT("unknown format specifier"));
// fall through and just copy it nevertheless
{
wxCHECK_MSG( end, false, "end iterator pointer must be specified" );
- // Set to current day and hour, so strings like '14:00' becomes today at
- // 14, not some other random date
- wxDateTime dtDate = wxDateTime::Today();
- wxDateTime dtTime = wxDateTime::Today();
+ wxDateTime
+ dtDate,
+ dtTime;
wxString::const_iterator
endTime,
while ( p != pEnd )
{
// skip white space and date delimiters
- while ( wxStrchr(".,/-\t\r\n ", *p) )
+ if ( wxStrchr(".,/-\t\r\n ", *p) )
{
++p;
+ continue;
}
// modify copy of the iterator as we're not sure if the next token is
"%I:%M:%S %p", // 12hour with AM/PM
"%H:%M:%S", // could be the same or 24 hour one so try it too
"%I:%M %p", // 12hour with AM/PM but without seconds
- "%H:%M:%S", // and a possibly 24 hour version without seconds
+ "%H:%M", // and a possibly 24 hour version without seconds
"%X", // possibly something from above or maybe something
// completely different -- try it last