From d8e0b2d36e1944ab747012ed7ba4612f0da48854 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 29 Aug 2014 20:26:11 +0000 Subject: WhatsApp: Changed formatting of status message git-svn-id: http://svn.miranda-ng.org/main/trunk@10338 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/contacts.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'protocols/WhatsApp/src/contacts.cpp') diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 49cdca0982..533f8c32ba 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -276,11 +276,16 @@ void WhatsAppProto::UpdateStatusMsg(MCONTACT hContact) if (lastSeen != -1) { time_t timestamp = time(NULL) - lastSeen; - - tm* t = localtime(×tamp); - ss << _T("Last seen on ") << std::setfill(_T('0')) << std::setw(2) << (t->tm_mon + 1) << - _T("/") << std::setw(2) << t->tm_mday << _T("/") << (t->tm_year + 1900) << _T(" ") - << std::setw(2) << t->tm_hour << _T(":") << std::setw(2) << t->tm_min; + + FILETIME ft; + UnixTimeToFileTime(timestamp, &ft); + SYSTEMTIME st; + FileTimeToSystemTime(&ft, &st); + + TCHAR stzDate[MAX_PATH], stzTime[MAX_PATH]; + GetTimeFormat(LOCALE_USER_DEFAULT, 0, &st,0, stzTime, SIZEOF(stzTime)); + GetDateFormat(LOCALE_USER_DEFAULT, 0, &st,0, stzDate, SIZEOF(stzDate)); + ss << TranslateT("Last seen on ") << stzDate << TranslateT(" at ") << stzTime; } int state = getDword(hContact, WHATSAPP_KEY_LAST_MSG_STATE, 2); -- cgit v1.2.3