From ba96fb5c2b6801398481a30189f991cff98fed8b Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Mon, 12 Sep 2011 16:06:58 -0700
Subject: [PATCH] EXP-1199 FIX -- Inbox new tag sometimes differs from recent
 item delivery times, sim timezone settings differences suspected.

* LastInventoryInboxActivity setting now stored as the value of time_correct(),
  the corrected time difference (established at login) between the client and
  official SL time.
---
 .../newview/app_settings/settings_per_account.xml  | 14 +++++++-------
 indra/newview/llpanelmarketplaceinbox.cpp          |  2 +-
 indra/newview/llpanelmarketplaceinboxinventory.cpp | 14 +++++---------
 indra/newview/llsidepanelinventory.cpp             |  4 ++--
 4 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index c7140283f19..d8295ddb876 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -34,15 +34,15 @@
             <string />
         </map>
     <key>LastInventoryInboxActivity</key>
-       <map>
-            <key>Comment</key>
+        <map>
+        <key>Comment</key>
             <string>The last time the received items inbox was poked by the user.</string>
-            <key>Persist</key>
+        <key>Persist</key>
             <integer>1</integer>
-            <key>Type</key>
-            <string>String</string>
-            <key>Value</key>
-            <string />
+        <key>Type</key>
+            <string>U32</string>
+        <key>Value</key>
+            <integer>0</integer>
         </map>
     <key>LastLogoff</key>
         <map>
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index 2cb91f771ff..4ea2ea24a19 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -116,7 +116,7 @@ void LLPanelMarketplaceInbox::onFocusReceived()
 
 	sidepanel_inventory->clearSelections(true, false, true);
 
-	gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString());
+	gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
 }
 
 BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg)
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp
index d51aa73c935..f525dbf4343 100644
--- a/indra/newview/llpanelmarketplaceinboxinventory.cpp
+++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp
@@ -192,20 +192,16 @@ void LLInboxFolderViewFolder::draw()
 
 void LLInboxFolderViewFolder::computeFreshness()
 {
-	const std::string& last_expansion = gSavedPerAccountSettings.getString("LastInventoryInboxActivity");
+	const U32 last_expansion = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity");
 
-	if (!last_expansion.empty())
+	if (last_expansion > 0)
 	{
-		// Inventory DB timezone is hardcoded to PDT or GMT-7, which is 7 hours behind GMT
-		const F64 SEVEN_HOURS_IN_SECONDS = 7 * 60 * 60;
-		const F64 saved_freshness_inventory_db_timezone = LLDate(last_expansion).secondsSinceEpoch() - SEVEN_HOURS_IN_SECONDS;
-
-		mFresh = (mCreationDate > saved_freshness_inventory_db_timezone);
+		mFresh = (mCreationDate > last_expansion);
 
 #if DEBUGGING_FRESHNESS
 		if (mFresh)
 		{
-			llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << saved_freshness_inventory_db_timezone << llendl;
+			llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion << llendl;
 		}
 #endif
 	}
@@ -219,7 +215,7 @@ void LLInboxFolderViewFolder::deFreshify()
 {
 	mFresh = false;
 
-	gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString());
+	gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
 }
 
 void LLInboxFolderViewFolder::selectItem()
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 9814e5b81ac..bd62b5c101a 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -539,7 +539,7 @@ void LLSidepanelInventory::onToggleInboxBtn()
 
 	if (inbox_expanded && inboxPanel->isInVisibleChain())
 	{
-		gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString());
+		gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
 	}
 }
 
@@ -568,7 +568,7 @@ void LLSidepanelInventory::onOpen(const LLSD& key)
 #else
 	if (mInboxEnabled && getChild<LLButton>(INBOX_BUTTON_NAME)->getToggleState())
 	{
-		gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString());
+		gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
 	}
 #endif
 
-- 
GitLab