Bug 552386 - test_history_sidebar.js fails between midnight and 2:00am with new DST settings, r=dietrich a=dholbert for CLOSED TREE
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 16 Mar 2010 02:02:50 +0100
changeset 39479 050887c641832a1775d0f431bee86c6ee555c3c8
parent 39478 a48606cc04acfe1941530823ff4de2f59958f912
child 39480 138f593553b66c9f815e8f57870c19d6347f7702
push idunknown
push userunknown
push dateunknown
reviewersdietrich, dholbert
bugs552386
milestone1.9.3a4pre
Bug 552386 - test_history_sidebar.js fails between midnight and 2:00am with new DST settings, r=dietrich a=dholbert for CLOSED TREE
toolkit/components/places/src/nsNavHistory.cpp
--- a/toolkit/components/places/src/nsNavHistory.cpp
+++ b/toolkit/components/places/src/nsNavHistory.cpp
@@ -3521,17 +3521,20 @@ PlacesSQLQueryBuilder::SelectAsDay()
         PRExplodedTime tm;
         PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &tm);
         PRUint16 currentYear = tm.tm_year;
         // Set day before month, setting month without day could cause issues.
         // For example setting month to February when today is 30, since
         // February has not 30 days, will return March instead.
         tm.tm_mday = 1;
         tm.tm_month -= MonthIndex;
-        PR_NormalizeTime(&tm, PR_LocalTimeParameters);
+        // Notice we use GMTParameters because we just want to get the first
+        // day of each month.  Using LocalTimeParameters would instead force us
+        // to apply a DST correction that we don't really need here.
+        PR_NormalizeTime(&tm, PR_GMTParameters);
         // tm_month starts from 0 while GetMonthName expects a 1-based index.
         history->GetMonthName(tm.tm_month+1, dateName);
 
         // If the container is for a past year, add the year as suffix.
         if (tm.tm_year < currentYear)
           dateName.Append(nsPrintfCString(" %d", tm.tm_year));
 
         // From start of MonthIndex + 1 months ago