From 8add3170fd6b46c0e4f745bacaab1e541b27a1b9 Mon Sep 17 00:00:00 2001 From: Tim Kosse Date: Sat, 2 Oct 2010 16:50:34 +0000 Subject: [PATCH] Backport r65494: Initialize all fields of struct tm used by wxDateTime::Format(). Closes #12455 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@65730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/datetime.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index aa597b5cd6..fba011fafc 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -2361,12 +2361,13 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const // 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