projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Disable symbols visibility support for the Clang compiler.
[wxWidgets.git]
/
src
/
common
/
datetimefmt.cpp
diff --git
a/src/common/datetimefmt.cpp
b/src/common/datetimefmt.cpp
index 39fc7f454657a842692457aadf88ab7b06e8f2ec..254c7034369f516ddc61a8fb9e6e35960acd9293 100644
(file)
--- a/
src/common/datetimefmt.cpp
+++ b/
src/common/datetimefmt.cpp
@@
-320,7
+320,7
@@
wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
format.Replace("%X",wxLocale::GetInfo(wxLOCALE_TIME_FMT));
#endif
// we have to use our own implementation if the date is out of range of
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 specifi
cato
rs
+ // strftime() or if we use non standard specifi
e
rs
#ifdef wxHAS_STRFTIME
time_t time = GetTicks();
#ifdef wxHAS_STRFTIME
time_t time = GetTicks();
@@
-374,12
+374,11
@@
wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
// used for calls to strftime() when we only deal with time
struct tm tmTimeOnly;
// 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_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
tmTimeOnly.tm_mon = 0;
tmTimeOnly.tm_year = 76;
tmTimeOnly.tm_isdst = 0; // no DST, we adjust for tz ourselves
@@
-649,9
+648,10
@@
wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
default:
// is it the format width?
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;
}
{
fmt += *p;
}
@@
-668,7
+668,7
@@
wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
}
// no, it wasn't the width
}
// no, it wasn't the width
- wxFAIL_MSG(wxT("unknown format specifi
cato
r"));
+ wxFAIL_MSG(wxT("unknown format specifi
e
r"));
// fall through and just copy it nevertheless
// fall through and just copy it nevertheless
@@
-1497,10
+1497,9
@@
wxDateTime::ParseDateTime(const wxString& date, wxString::const_iterator *end)
{
wxCHECK_MSG( end, false, "end iterator pointer must be specified" );
{
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,
wxString::const_iterator
endTime,
@@
-1559,7
+1558,7
@@
wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end)
const wxString::const_iterator pEnd = date.end();
wxString::const_iterator p = pBegin;
const wxString::const_iterator pEnd = date.end();
wxString::const_iterator p = pBegin;
- while ( wxIsspace(*p) )
+ while (
p != pEnd &&
wxIsspace(*p) )
p++;
// some special cases
p++;
// some special cases
@@
-1626,9
+1625,10
@@
wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end)
while ( p != pEnd )
{
// skip white space and date delimiters
while ( p != pEnd )
{
// skip white space and date delimiters
-
while
( wxStrchr(".,/-\t\r\n ", *p) )
+
if
( wxStrchr(".,/-\t\r\n ", *p) )
{
++p;
{
++p;
+ continue;
}
// modify copy of the iterator as we're not sure if the next token is
}
// modify copy of the iterator as we're not sure if the next token is
@@
-1922,14
+1922,13
@@
wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end)
for ( size_t n = 0; n < WXSIZEOF(stdTimes); n++ )
{
const wxString timeString = wxGetTranslation(stdTimes[n].name);
for ( size_t n = 0; n < WXSIZEOF(stdTimes); n++ )
{
const wxString timeString = wxGetTranslation(stdTimes[n].name);
- const wxString::const_iterator p = time.begin() + timeString.length();
- if ( timeString.CmpNoCase(wxString(time.begin(), p)) == 0 )
+ if ( timeString.CmpNoCase(wxString(time, timeString.length())) == 0 )
{
// casts required by DigitalMars
Set(stdTimes[n].hour, wxDateTime_t(0), wxDateTime_t(0));
if ( end )
{
// casts required by DigitalMars
Set(stdTimes[n].hour, wxDateTime_t(0), wxDateTime_t(0));
if ( end )
- *end =
p
;
+ *end =
time.begin() + timeString.length()
;
return true;
}
return true;
}
@@
-1942,7
+1941,7
@@
wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end)
"%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
"%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
"%X", // possibly something from above or maybe something
// completely different -- try it last