Bug 552386 - test_history_sidebar.js fails between midnight and 2:00am with new DST settings, r=dietrich a=LegNeato
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 16 Mar 2010 02:02:50 +0100
changeset 34436 7612534ea1efac20bffde0bced8811039139c654
parent 34435 228d5ccfddc31c9aa81feb2186f5297a546d2983
child 34437 ef182e952f70de8298bdc6f89cf2388e11d8d1a5
push id1467
push usermak77@bonardo.net
push dateFri, 16 Jul 2010 15:30:39 +0000
reviewersdietrich, LegNeato
bugs552386
milestone1.9.2.8pre
Bug 552386 - test_history_sidebar.js fails between midnight and 2:00am with new DST settings, r=dietrich a=LegNeato
toolkit/components/places/src/nsNavHistory.cpp
--- a/toolkit/components/places/src/nsNavHistory.cpp
+++ b/toolkit/components/places/src/nsNavHistory.cpp
@@ -3488,17 +3488,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