Initialize all fields of struct tm used by wxDateTime::Format().
Passing not fully initialized struct tm to strftime() results in Valgrind errors and possible nastiness, see #12455. Simply use memset() to set all fields of this system-dependent struct to 0 initially. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
// used for calls to strftime() when we only deal with time
|
||||||
struct tm tmTimeOnly;
|
struct tm tmTimeOnly;
|
||||||
|
memset(&tmTimeOnly, 0, sizeof(tmTimeOnly));
|
||||||
tmTimeOnly.tm_hour = tm.hour;
|
tmTimeOnly.tm_hour = tm.hour;
|
||||||
tmTimeOnly.tm_min = tm.min;
|
tmTimeOnly.tm_min = tm.min;
|
||||||
tmTimeOnly.tm_sec = tm.sec;
|
tmTimeOnly.tm_sec = tm.sec;
|
||||||
tmTimeOnly.tm_wday = 0;
|
tmTimeOnly.tm_mday = 1; // any date will do, use 1976-01-01
|
||||||
tmTimeOnly.tm_yday = 0;
|
|
||||||
tmTimeOnly.tm_mday = 1; // any date will do
|
|
||||||
tmTimeOnly.tm_mon = 0;
|
tmTimeOnly.tm_mon = 0;
|
||||||
tmTimeOnly.tm_year = 76;
|
tmTimeOnly.tm_year = 76;
|
||||||
tmTimeOnly.tm_isdst = 0; // no DST, we adjust for tz ourselves
|
tmTimeOnly.tm_isdst = 0; // no DST, we adjust for tz ourselves
|
||||||
|
|||||||
Reference in New Issue
Block a user