Bug 309932 mail imported from Outlook Sent folder has wrong date (timezone confusion). r=bienvenu,sr=Standard8
authorJorg K <mozilla@jorgk.com>
Thu, 17 Jun 2010 09:43:02 +0100
changeset 5837 218413802a0df41e3fd0310d8fcae2a63f3a40d3
parent 5836 cbaa2cb21cf3a44858fd7da4949291fc69395422
child 5838 ff850f63668a23cb34ee107880188cdbbb377e4a
push idunknown
push userunknown
push dateunknown
reviewersbienvenu, Standard8
bugs309932
Bug 309932 mail imported from Outlook Sent folder has wrong date (timezone confusion). r=bienvenu,sr=Standard8
mailnews/import/outlook/src/MapiMessage.cpp
--- a/mailnews/import/outlook/src/MapiMessage.cpp
+++ b/mailnews/import/outlook/src/MapiMessage.cpp
@@ -181,23 +181,27 @@ void CMapiMessage::AddFrom( nsCString& s
 
 void CMapiMessage::AddDate( nsCString& str)
 {
   LPSPropValue pVal = CMapiApi::GetMapiProperty( m_lpMsg, PR_MESSAGE_DELIVERY_TIME);
   if (!pVal)
     pVal = CMapiApi::GetMapiProperty( m_lpMsg, PR_CREATION_TIME);
   if (pVal) {
     SYSTEMTIME st;
+    // the following call returns UTC
     ::FileTimeToSystemTime( &(pVal->Value.ft), &st);
     CMapiApi::MAPIFreeBuffer( pVal);
     str.Trim( kWhitespace, PR_FALSE, PR_TRUE);
     if (!str.IsEmpty())
       str += "\x0D\x0A";
     str += "Date: ";
-    FormatDateTime( st, str);
+    // FormatDateTime would append the local time zone, so don't use it.
+    // Instead, we just append +0000 for GMT/UTC here.
+    FormatDateTime( st, str, FALSE);
+    str += " +0000";
   }
 }
 
 
 void CMapiMessage::BuildFromLine( void)
 {
   m_fromLine = sFromLine;
   LPSPropValue pVal = CMapiApi::GetMapiProperty( m_lpMsg, PR_CREATION_TIME);