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
--- 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( <ime );
- 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);