From 583f3768d24ceb7b0bee451f9a0975d25f826ee6 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Thu, 14 Apr 2016 15:08:48 +0000 Subject: Tipper: date without year is valid git-svn-id: http://svn.miranda-ng.org/main/trunk@16652 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TipperYM/src/translations.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'plugins/TipperYM/src') diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index c20915147e..8e85ebd902 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -249,23 +249,20 @@ TCHAR *DayMonthYearToDate(MCONTACT hContact, const char *szModuleName, const cha db_free(&dbv); mir_snprintf(szSettingName, "%sYear", prefix); int year = 0; - if (!db_get(hContact, szModuleName, szSettingName, &dbv)) - { - if (GetInt(dbv, &year) && year != 0) - { - db_free(&dbv); + db_get(hContact, szModuleName, szSettingName, &dbv); - SYSTEMTIME st = {0}; - st.wDay = day; - st.wMonth = month; - st.wYear = year; + GetInt(dbv, &year); + db_free(&dbv); - GetDateFormat(LOCALE_USER_DEFAULT, 0, &st, 0, buff, bufflen); - return buff; - } - else - db_free(&dbv); - } + tm time = { 0 }; + time.tm_mday = day; + time.tm_mon = month - 1; + time.tm_year = year - 1900; + + _tcsftime(buff, bufflen, _T("%x"), &time); + + return buff; + } else db_free(&dbv); -- cgit v1.2.3