Bug 1362817 - Use PRTime instead of time_t in nsSimplePageSequenceFrame::Reflow. r?m_kato draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Tue, 19 Sep 2017 18:35:21 +0900
changeset 666861 c6a2cf21095f755b5f38d27ff0c98374ca2a4730
parent 666598 30a386ff1192cba08a2f899343f81f6946bc6148
child 666862 b2e4217c8b88897bc49dd1247657da7f0079f10c
push id80526
push userbmo:mantaroh@gmail.com
push dateTue, 19 Sep 2017 09:35:38 +0000
reviewersm_kato
bugs1362817
milestone57.0a1
Bug 1362817 - Use PRTime instead of time_t in nsSimplePageSequenceFrame::Reflow. r?m_kato The nsSimplePageSequenceFrame::Reflow calls DateTimeFormat::FormatTime(). In 32 bit environment, this conversion will overflow. So this patch will use DateTimeFormat::FormatPRTime() instead of it. MozReview-Commit-ID: 3b1GhlrJDKM
layout/generic/nsSimplePageSequenceFrame.cpp
--- a/layout/generic/nsSimplePageSequenceFrame.cpp
+++ b/layout/generic/nsSimplePageSequenceFrame.cpp
@@ -306,22 +306,21 @@ nsSimplePageSequenceFrame::Reflow(nsPres
                "only expecting nsPageFrame children. Other children will make "
                "this static_cast bogus & probably violate other assumptions");
     nsPageFrame* pf = static_cast<nsPageFrame*>(e.get());
     pf->SetPageNumInfo(pageNum, pageTot);
     pageNum++;
   }
 
   nsAutoString formattedDateString;
-  time_t ltime;
-  time( &ltime );
-  if (NS_SUCCEEDED(DateTimeFormat::FormatTime(kDateFormatShort,
-                                              kTimeFormatNoSeconds,
-                                              ltime,
-                                              formattedDateString))) {
+  PRTime now = PR_Now();
+  if (NS_SUCCEEDED(DateTimeFormat::FormatPRTime(kDateFormatShort,
+                                                kTimeFormatNoSeconds,
+                                                now,
+                                                formattedDateString))) {
     SetDateTimeStr(formattedDateString);
   }
 
   // Return our desired size
   // Adjust the reflow size by PrintPreviewScale so the scrollbars end up the
   // correct size
   SetDesiredSize(aDesiredSize, aReflowInput, maxXMost, y);