Bug 773782 - Stop using LL_* macros. r=Neil

--HG--
extra : rebase_source : 35e5adf4c8df76c2022e4dc7931777cdd96f4788
This commit is contained in:
Joshua Cranmer 2012-07-12 14:26:29 -05:00
Родитель 89c9626f16
Коммит 02fa657e28
32 изменённых файлов: 101 добавлений и 283 удалений

Просмотреть файл

@ -31,11 +31,11 @@ static NS_DEFINE_CID(kLDAPOperationCID, NS_LDAPOPERATION_CID);
// //
nsLDAPServiceEntry::nsLDAPServiceEntry() nsLDAPServiceEntry::nsLDAPServiceEntry()
: mLeases(0), : mLeases(0),
mTimestamp(0),
mDelete(false), mDelete(false),
mRebinding(false) mRebinding(false)
{ {
mTimestamp = LL_Zero();
} }
// Init function // Init function

Просмотреть файл

@ -31,8 +31,8 @@
nsNetscapeProfileMigratorBase::nsNetscapeProfileMigratorBase() nsNetscapeProfileMigratorBase::nsNetscapeProfileMigratorBase()
{ {
mObserverService = do_GetService("@mozilla.org/observer-service;1"); mObserverService = do_GetService("@mozilla.org/observer-service;1");
mMaxProgress = LL_ZERO; mMaxProgress = 0;
mCurrentProgress = LL_ZERO; mCurrentProgress = 0;
mFileCopyTransactionIndex = 0; mFileCopyTransactionIndex = 0;
} }
@ -349,7 +349,6 @@ void nsNetscapeProfileMigratorBase::CopyNextFolder()
{ {
if (mFileCopyTransactionIndex < mFileCopyTransactions.Length()) if (mFileCopyTransactionIndex < mFileCopyTransactions.Length())
{ {
PRUint32 percentage = 0;
fileTransactionEntry fileTransaction = fileTransactionEntry fileTransaction =
mFileCopyTransactions.ElementAt(mFileCopyTransactionIndex++); mFileCopyTransactions.ElementAt(mFileCopyTransactionIndex++);
@ -360,14 +359,9 @@ void nsNetscapeProfileMigratorBase::CopyNextFolder()
// add to our current progress // add to our current progress
PRInt64 fileSize; PRInt64 fileSize;
fileTransaction.srcFile->GetFileSize(&fileSize); fileTransaction.srcFile->GetFileSize(&fileSize);
LL_ADD(mCurrentProgress, mCurrentProgress, fileSize); mCurrentProgress += fileSize;
PRInt64 percentDone; PRUint32 percentage = (PRUint32)(mCurrentProgress * 100 / mMaxProgress);
LL_MUL(percentDone, mCurrentProgress, 100);
LL_DIV(percentDone, percentDone, mMaxProgress);
LL_L2UI(percentage, percentDone);
nsAutoString index; nsAutoString index;
index.AppendInt(percentage); index.AppendInt(percentage);

Просмотреть файл

@ -101,7 +101,7 @@ nsSeamonkeyProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup
fileTransactionEntry fileTransaction = mFileCopyTransactions.ElementAt(i); fileTransactionEntry fileTransaction = mFileCopyTransactions.ElementAt(i);
PRInt64 fileSize; PRInt64 fileSize;
fileTransaction.srcFile->GetFileSize(&fileSize); fileTransaction.srcFile->GetFileSize(&fileSize);
LL_ADD(mMaxProgress, mMaxProgress, fileSize); mMaxProgress += fileSize;
} }
CopyNextFolder(); CopyNextFolder();

Просмотреть файл

@ -180,5 +180,8 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, value)
#define NS_MSG_BASE #define NS_MSG_BASE
#define NS_MSG_BASE_STATIC_MEMBER_(type) type #define NS_MSG_BASE_STATIC_MEMBER_(type) type
/// The number of microseconds in a day. This comes up a lot.
#define PR_USEC_PER_DAY (PRTime(PR_USEC_PER_SEC) * 60 * 60 * 24)
#endif // msgCore_h__ #endif // msgCore_h__

Просмотреть файл

@ -254,10 +254,8 @@ nsMsgFilterList::GetLogStream(nsIOutputStream **aLogStream)
rv = logFile->GetFileSize(&fileSize); rv = logFile->GetFileSize(&fileSize);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
PRUint32 fileLen;;
LL_L2UI(fileLen, fileSize);
// write the header at the start // write the header at the start
if (fileLen == 0) if (fileSize == 0)
{ {
PRUint32 writeCount; PRUint32 writeCount;

Просмотреть файл

@ -740,8 +740,7 @@ nsresult nsMsgSearchOfflineMail::Search (bool *aDone)
{ {
AddResultElement (msgDBHdr); AddResultElement (msgDBHdr);
} }
PRIntervalTime elapsedTime; PRIntervalTime elapsedTime = PR_IntervalNow() - startTime;
LL_SUB(elapsedTime, PR_IntervalNow(), startTime);
// check if more than kTimeSliceInMS milliseconds have elapsed in this time slice started // check if more than kTimeSliceInMS milliseconds have elapsed in this time slice started
if (PR_IntervalToMilliseconds(elapsedTime) > kTimeSliceInMS) if (PR_IntervalToMilliseconds(elapsedTime) > kTimeSliceInMS)
break; break;

Просмотреть файл

@ -472,13 +472,7 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, bool really
// we need to adjust the date so we get greater than and not greater than or equal to which // we need to adjust the date so we get greater than and not greater than or equal to which
// is what the IMAP server wants to search on // is what the IMAP server wants to search on
// won't work on Mac. // won't work on Mac.
// ack, is this right? is PRTime seconds or microseconds? adjustedDate += PR_USEC_PER_DAY;
PRInt64 microSecondsPerSecond, secondsInDay, microSecondsInDay;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(secondsInDay, 60 * 60 * 24);
LL_MUL(microSecondsInDay, secondsInDay, microSecondsPerSecond);
LL_ADD(adjustedDate, adjustedDate, microSecondsInDay); // bump up to the day after this one...
} }
PRExplodedTime exploded; PRExplodedTime exploded;
@ -498,15 +492,8 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, bool really
searchValue->GetAge(&ageInDays); searchValue->GetAge(&ageInDays);
PRTime now = PR_Now(); PRTime now = PR_Now();
PRTime matchDay; PRTime matchDay = now - ageInDays * PR_USEC_PER_DAY;
PRInt64 microSecondsPerSecond, secondsInDays, microSecondsInDay;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_I2L(secondsInDays, 60 * 60 * 24 * ageInDays);
LL_MUL(microSecondsInDay, secondsInDays, microSecondsPerSecond);
LL_SUB(matchDay, now, microSecondsInDay); // = now - term->m_value.u.age * 60 * 60 * 24;
PRExplodedTime exploded; PRExplodedTime exploded;
PR_ExplodeTime(matchDay, PR_LocalTimeParameters, &exploded); PR_ExplodeTime(matchDay, PR_LocalTimeParameters, &exploded);
PR_FormatTimeUSEnglish(dateBuf, sizeof(dateBuf), "%d-%b-%Y", &exploded); PR_FormatTimeUSEnglish(dateBuf, sizeof(dateBuf), "%d-%b-%Y", &exploded);

Просмотреть файл

@ -1283,16 +1283,9 @@ nsresult nsMsgSearchTerm::MatchAge (PRTime msgDate, bool *pResult)
nsresult err = NS_OK; nsresult err = NS_OK;
PRTime now = PR_Now(); PRTime now = PR_Now();
PRTime cutOffDay; PRTime cutOffDay = now - m_value.u.age * PR_USEC_PER_DAY;
PRInt64 microSecondsPerSecond, secondsInDays, microSecondsInDays; bool cutOffDayInTheFuture = m_value.u.age < 0;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_I2L(secondsInDays, 60 * 60 * 24 * m_value.u.age);
LL_MUL(microSecondsInDays, secondsInDays, microSecondsPerSecond);
LL_SUB(cutOffDay, now, microSecondsInDays); // = now - term->m_value.u.age * 60 * 60 * 24;
bool cutOffDayInTheFuture = LL_CMP(m_value.u.age, <, 0);
// So now cutOffDay is the PRTime cut-off point. // So now cutOffDay is the PRTime cut-off point.
// Any msg with a time less than that will be past the age. // Any msg with a time less than that will be past the age.
@ -1300,13 +1293,13 @@ nsresult nsMsgSearchTerm::MatchAge (PRTime msgDate, bool *pResult)
switch (m_operator) switch (m_operator)
{ {
case nsMsgSearchOp::IsGreaterThan: // is older than, or more in the future case nsMsgSearchOp::IsGreaterThan: // is older than, or more in the future
if ((!cutOffDayInTheFuture && LL_CMP(msgDate, <, cutOffDay)) || if ((!cutOffDayInTheFuture && msgDate < cutOffDay) ||
(cutOffDayInTheFuture && LL_CMP(msgDate, >, cutOffDay))) (cutOffDayInTheFuture && msgDate > cutOffDay))
result = true; result = true;
break; break;
case nsMsgSearchOp::IsLessThan: // is younger than, or less in the future case nsMsgSearchOp::IsLessThan: // is younger than, or less in the future
if ((!cutOffDayInTheFuture && LL_CMP(msgDate, >, cutOffDay)) || if ((!cutOffDayInTheFuture && msgDate > cutOffDay) ||
(cutOffDayInTheFuture && LL_CMP(msgDate, <, cutOffDay))) (cutOffDayInTheFuture && msgDate < cutOffDay))
result = true; result = true;
break; break;
case nsMsgSearchOp::Is: case nsMsgSearchOp::Is:

Просмотреть файл

@ -282,10 +282,8 @@ nsresult nsMsgBiffManager::SetupNextBiff()
if (currentTime > biffEntry.nextBiffTime) if (currentTime > biffEntry.nextBiffTime)
{ {
PRInt64 microSecondsPerSecond; // Let's wait 30 seconds before firing biff again
biffDelay = 30 * PR_USEC_PER_SEC;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_MUL(biffDelay, 30, microSecondsPerSecond); //let's wait 30 seconds before firing biff again
} }
else else
biffDelay = biffEntry.nextBiffTime - currentTime; biffDelay = biffEntry.nextBiffTime - currentTime;

Просмотреть файл

@ -712,46 +712,24 @@ nsresult nsMsgDBView::FetchDate(nsIMsgDBHdr * aHdr, nsAString &aDateString, bool
// the following chunk of code allows us to show a day instead of a number if the message was received // the following chunk of code allows us to show a day instead of a number if the message was received
// within the last 7 days. i.e. Mon 5:10pm. (depending on the mail.ui.display.dateformat.thisweek pref) // within the last 7 days. i.e. Mon 5:10pm. (depending on the mail.ui.display.dateformat.thisweek pref)
// The concrete format used is dependent on a preference setting (see InitDisplayFormats). // The concrete format used is dependent on a preference setting (see InitDisplayFormats).
else if (LL_CMP(currentTime, >, dateOfMsg)) else if (currentTime > dateOfMsg)
{ {
// some constants for calculation // Convert the times from GMT to local time
static PRInt64 microSecondsPerSecond; PRInt64 GMTLocalTimeShift = PR_USEC_PER_SEC *
static PRInt64 secondsPerDay; PRInt64(explodedCurrentTime.tm_params.tp_gmt_offset +
static PRInt64 microSecondsPerDay; explodedCurrentTime.tm_params.tp_dst_offset);
static PRInt64 microSecondsPer6Days; currentTime += GMTLocalTimeShift;
dateOfMsgLocal = dateOfMsg + GMTLocalTimeShift;
static bool bGotConstants = false; // Find the most recent midnight
if ( !bGotConstants ) PRInt64 todaysMicroSeconds = currentTime % PR_USEC_PER_DAY;
{ PRInt64 mostRecentMidnight = currentTime - todaysMicroSeconds;
// seeds
LL_I2L ( microSecondsPerSecond, PR_USEC_PER_SEC );
LL_UI2L ( secondsPerDay, 60 * 60 * 24 );
// derivees
LL_MUL( microSecondsPerDay, secondsPerDay, microSecondsPerSecond );
LL_MUL( microSecondsPer6Days, microSecondsPerDay, 6 );
bGotConstants = true;
}
// setting the time variables to local time
PRInt64 GMTLocalTimeShift;
LL_ADD( GMTLocalTimeShift, explodedCurrentTime.tm_params.tp_gmt_offset, explodedCurrentTime.tm_params.tp_dst_offset );
LL_MUL( GMTLocalTimeShift, GMTLocalTimeShift, microSecondsPerSecond );
LL_ADD( currentTime, currentTime, GMTLocalTimeShift );
LL_ADD( dateOfMsgLocal, dateOfMsg, GMTLocalTimeShift );
// the most recent midnight, counting from current time
PRInt64 todaysMicroSeconds, mostRecentMidnight;
LL_MOD( todaysMicroSeconds, currentTime, microSecondsPerDay );
LL_SUB( mostRecentMidnight, currentTime, todaysMicroSeconds );
// most recent midnight minus 6 days // most recent midnight minus 6 days
PRInt64 mostRecentWeek; PRInt64 mostRecentWeek = mostRecentMidnight - (PR_USEC_PER_DAY * 6);
LL_SUB( mostRecentWeek, mostRecentMidnight, microSecondsPer6Days );
// was the message sent during the last week? // was the message sent during the last week?
if ( LL_CMP( dateOfMsgLocal, >=, mostRecentWeek ) ) if (dateOfMsgLocal >= mostRecentWeek)
{ // yes .... { // yes ....
dateFormat = m_dateFormatThisWeek; dateFormat = m_dateFormatThisWeek;
} }

Просмотреть файл

@ -130,56 +130,30 @@ nsresult nsMsgGroupView::GetAgeBucketValue(nsIMsgDBHdr *aMsgHdr, PRUint32 * aAge
*aAgeBucket = 1; *aAgeBucket = 1;
} }
// figure out how many days ago this msg arrived // figure out how many days ago this msg arrived
else if (LL_CMP(currentTime, >, dateOfMsg)) else if (currentTime > dateOfMsg)
{ {
// some constants for calculation
static PRInt64 microSecondsPerSecond;
static PRInt64 microSecondsPerDay;
static PRInt64 secondsPerDay;
static PRInt64 microSecondsPer6Days;
static PRInt64 microSecondsPer13Days;
static bool bGotConstants = false;
if ( !bGotConstants )
{
// seeds
LL_I2L ( microSecondsPerSecond, PR_USEC_PER_SEC );
LL_UI2L ( secondsPerDay, 60 * 60 * 24 );
// derivees
LL_MUL( microSecondsPerDay, secondsPerDay, microSecondsPerSecond );
LL_MUL( microSecondsPer6Days, microSecondsPerDay, 6 );
LL_MUL( microSecondsPer13Days, microSecondsPerDay, 13 );
bGotConstants = true;
}
// setting the time variables to local time // setting the time variables to local time
PRInt64 GMTLocalTimeShift; PRInt64 GMTLocalTimeShift = currentExplodedTime.tm_params.tp_gmt_offset +
LL_ADD( GMTLocalTimeShift, currentExplodedTime.tm_params.tp_gmt_offset, currentExplodedTime.tm_params.tp_dst_offset ); currentExplodedTime.tm_params.tp_dst_offset;
LL_MUL( GMTLocalTimeShift, GMTLocalTimeShift, microSecondsPerSecond ); GMTLocalTimeShift *= PR_USEC_PER_SEC;
LL_ADD( currentTime, currentTime, GMTLocalTimeShift ); currentTime += GMTLocalTimeShift;
LL_ADD( dateOfMsg, dateOfMsg, GMTLocalTimeShift ); dateOfMsg += GMTLocalTimeShift;
// the most recent midnight, counting from current time // the most recent midnight, counting from current time
PRInt64 todaysMicroSeconds, mostRecentMidnight; PRInt64 mostRecentMidnight = currentTime - currentTime % PR_USEC_PER_DAY;
LL_MOD( todaysMicroSeconds, currentTime, microSecondsPerDay ); PRInt64 yesterday = mostRecentMidnight - PR_USEC_PER_DAY;
LL_SUB( mostRecentMidnight, currentTime, todaysMicroSeconds );
PRInt64 yesterday;
LL_SUB( yesterday, mostRecentMidnight, microSecondsPerDay );
// most recent midnight minus 6 days // most recent midnight minus 6 days
PRInt64 mostRecentWeek; PRInt64 mostRecentWeek = mostRecentMidnight - (PR_USEC_PER_DAY * 6);
LL_SUB( mostRecentWeek, mostRecentMidnight, microSecondsPer6Days );
// was the message sent yesterday? // was the message sent yesterday?
if ( LL_CMP( dateOfMsg, >=, yesterday ) ) // yes .... if (dateOfMsg >= yesterday) // yes ....
*aAgeBucket = 2; *aAgeBucket = 2;
else if ( LL_CMP(dateOfMsg, >=, mostRecentWeek) ) else if (dateOfMsg >= mostRecentWeek)
*aAgeBucket = 3; *aAgeBucket = 3;
else else
{ {
PRInt64 lastTwoWeeks; PRInt64 lastTwoWeeks = mostRecentMidnight - PR_USEC_PER_DAY * 13;
LL_SUB( lastTwoWeeks, mostRecentMidnight, microSecondsPer13Days); *aAgeBucket = (dateOfMsg >= lastTwoWeeks) ? 4 : 5;
*aAgeBucket = LL_CMP(dateOfMsg, >=, lastTwoWeeks) ? 4 : 5;
} }
} }
return NS_OK; return NS_OK;

Просмотреть файл

@ -214,8 +214,7 @@ nsresult nsMsgPurgeService::PerformPurge()
PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("purging %s", curFolderUri.get())); PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("purging %s", curFolderUri.get()));
childFolder->ApplyRetentionSettings(); childFolder->ApplyRetentionSettings();
} }
PRIntervalTime elapsedTime; PRIntervalTime elapsedTime = PR_IntervalNow() - startTime;
LL_SUB(elapsedTime, PR_IntervalNow(), startTime);
// check if more than 500 milliseconds have elapsed in this purge process // check if more than 500 milliseconds have elapsed in this purge process
if (PR_IntervalToMilliseconds(elapsedTime) > 500) if (PR_IntervalToMilliseconds(elapsedTime) > 500)
{ {

Просмотреть файл

@ -26,9 +26,9 @@
#define MSGFEEDBACK_TIMER_INTERVAL 500 #define MSGFEEDBACK_TIMER_INTERVAL 500
nsMsgStatusFeedback::nsMsgStatusFeedback() : nsMsgStatusFeedback::nsMsgStatusFeedback() :
m_lastPercent(0) m_lastPercent(0),
m_lastProgressTime(0)
{ {
LL_I2L(m_lastProgressTime, 0);
nsresult rv; nsresult rv;
nsCOMPtr<nsIStringBundleService> bundleService = nsCOMPtr<nsIStringBundleService> bundleService =
@ -215,18 +215,11 @@ nsMsgStatusFeedback::ShowProgress(PRInt32 aPercentage)
m_lastPercent = aPercentage; m_lastPercent = aPercentage;
PRInt64 nowMS; PRInt64 nowMS = 0;
LL_I2L(nowMS, 0);
if (aPercentage < 100) // always need to do 100% if (aPercentage < 100) // always need to do 100%
{ {
int64 minIntervalBetweenProgress; nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
if (nowMS < m_lastProgressTime + 250)
LL_I2L(minIntervalBetweenProgress, 250);
int64 diffSinceLastProgress;
LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
LL_SUB(diffSinceLastProgress, nowMS, m_lastProgressTime); // r = a - b
LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b
if (!LL_GE_ZERO(diffSinceLastProgress))
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -260,7 +260,7 @@ nsresult nsMsgXFViewThread::AddHdr(nsIMsgDBHdr *newHdr,
// if (NS_SUCCEEDED(rv) && topLevelHdr) // if (NS_SUCCEEDED(rv) && topLevelHdr)
// { // {
// topLevelHdr->GetDate(&topLevelHdrDate); // topLevelHdr->GetDate(&topLevelHdrDate);
// if (LL_CMP(newHdrDate, <, topLevelHdrDate)) // if (newHdrDate < topLevelHdrDate)
// } // }
// } // }

Просмотреть файл

@ -218,10 +218,8 @@ nsSpamSettings::GetLogStream(nsIOutputStream **aLogStream)
rv = mLogFile->GetFileSize(&fileSize); rv = mLogFile->GetFileSize(&fileSize);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
PRUint32 fileLen;
LL_L2UI(fileLen, fileSize);
// write the header at the start // write the header at the start
if (fileLen == 0) if (fileSize == 0)
{ {
PRUint32 writeCount; PRUint32 writeCount;

Просмотреть файл

@ -151,7 +151,7 @@ nsMsgDBFolder::nsMsgDBFolder(void)
#endif #endif
initializeStrings(); initializeStrings();
createCollationKeyGenerator(); createCollationKeyGenerator();
LL_I2L(gtimeOfLastPurgeCheck, 0); gtimeOfLastPurgeCheck = 0;
} }
mProcessingFlag[0].bit = nsMsgProcessingFlags::ClassifyJunk; mProcessingFlag[0].bit = nsMsgProcessingFlags::ClassifyJunk;

Просмотреть файл

@ -1294,29 +1294,17 @@ NS_MSG_BASE nsresult NS_GetLocalizedUnicharPreferenceWithDefault(nsIPrefBranch *
void PRTime2Seconds(PRTime prTime, PRUint32 *seconds) void PRTime2Seconds(PRTime prTime, PRUint32 *seconds)
{ {
PRInt64 microSecondsPerSecond, intermediateResult; *seconds = (PRUint32)(prTime / PR_USEC_PER_SEC);
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_DIV(intermediateResult, prTime, microSecondsPerSecond);
LL_L2UI((*seconds), intermediateResult);
} }
void PRTime2Seconds(PRTime prTime, PRInt32 *seconds) void PRTime2Seconds(PRTime prTime, PRInt32 *seconds)
{ {
PRInt64 microSecondsPerSecond, intermediateResult; *seconds = (PRInt32)(prTime / PR_USEC_PER_SEC);
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_DIV(intermediateResult, prTime, microSecondsPerSecond);
LL_L2I((*seconds), intermediateResult);
} }
void Seconds2PRTime(PRUint32 seconds, PRTime *prTime) void Seconds2PRTime(PRUint32 seconds, PRTime *prTime)
{ {
PRInt64 microSecondsPerSecond, intermediateResult; *prTime = (PRTime)seconds * PR_USEC_PER_SEC;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(intermediateResult, seconds);
LL_MUL((*prTime), intermediateResult, microSecondsPerSecond);
} }
nsresult GetSummaryFileLocation(nsIFile* fileLocation, nsIFile** summaryLocation) nsresult GetSummaryFileLocation(nsIFile* fileLocation, nsIFile** summaryLocation)
@ -2141,12 +2129,9 @@ NS_MSG_BASE nsresult MsgPromptLoginFailed(nsIMsgWindow *aMsgWindow,
NS_MSG_BASE PRTime MsgConvertAgeInDaysToCutoffDate(PRInt32 ageInDays) NS_MSG_BASE PRTime MsgConvertAgeInDaysToCutoffDate(PRInt32 ageInDays)
{ {
PRInt64 secondsInDays, microSecondsInDay;
PRTime now = PR_Now(); PRTime now = PR_Now();
secondsInDays = 60 * 60 * 24 * ageInDays; return now - PR_USEC_PER_DAY * ageInDays;
microSecondsInDay = secondsInDays * PR_USEC_PER_SEC;
return now - microSecondsInDay;
} }
NS_MSG_BASE nsresult MsgTermListToString(nsISupportsArray *aTermList, nsCString &aOutString) NS_MSG_BASE nsresult MsgTermListToString(nsISupportsArray *aTermList, nsCString &aOutString)

Просмотреть файл

@ -709,9 +709,7 @@ GenerateGlobalRandomBytes(unsigned char *buf, PRInt32 len)
{ {
// Seed the random-number generator with current time so that // Seed the random-number generator with current time so that
// the numbers will be different every time we run. // the numbers will be different every time we run.
PRInt32 aTime; srand( (unsigned)PR_Now() );
LL_L2I(aTime, PR_Now());
srand( (unsigned)aTime );
firstTime = false; firstTime = false;
} }
@ -1085,13 +1083,7 @@ static bool isValidHost( const char* host )
char * char *
msg_generate_message_id (nsIMsgIdentity *identity) msg_generate_message_id (nsIMsgIdentity *identity)
{ {
PRUint32 now; PRUint32 now = (PRUint32)(PR_Now() / PR_USEC_PER_SEC);
PRTime prNow = PR_Now();
PRInt64 microSecondsPerSecond, intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_DIV(intermediateResult, prNow, microSecondsPerSecond);
LL_L2UI(now, intermediateResult);
PRUint32 salt = 0; PRUint32 salt = 0;
const char *host = 0; const char *host = 0;

Просмотреть файл

@ -274,9 +274,7 @@ nsURLFetcher::OnStopRequest(nsIRequest *request, nsISupports * ctxt, nsresult aS
/* In case of multipart/x-mixed-replace, we need to truncate the file to the current part size */ /* In case of multipart/x-mixed-replace, we need to truncate the file to the current part size */
if (MsgLowerCaseEqualsLiteral(mConverterContentType, MULTIPART_MIXED_REPLACE)) if (MsgLowerCaseEqualsLiteral(mConverterContentType, MULTIPART_MIXED_REPLACE))
{ {
PRInt64 fileSize; mLocalFile->SetFileSize(mTotalWritten);
LL_I2L(fileSize, mTotalWritten);
mLocalFile->SetFileSize(fileSize);
} }
} }

Просмотреть файл

@ -5233,16 +5233,8 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
return rv; return rv;
bool hasMore = false; bool hasMore = false;
PRTime now = PR_Now(); PRTime cutOffDay = PR_Now() - daysToKeepHdrs * PR_USEC_PER_DAY;
PRTime cutOffDay;
PRInt64 microSecondsPerSecond, secondsInDays, microSecondsInDay;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(secondsInDays, 60 * 60 * 24 * daysToKeepHdrs);
LL_MUL(microSecondsInDay, secondsInDays, microSecondsPerSecond);
LL_SUB(cutOffDay, now, microSecondsInDay); // = now - term->m_value.u.age * 60 * 60 * 24;
// so now cutOffDay is the PRTime cut-off point. Any msg with a date less than that will get purged. // so now cutOffDay is the PRTime cut-off point. Any msg with a date less than that will get purged.
while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && hasMore) while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && hasMore)
{ {
@ -5273,7 +5265,7 @@ nsresult nsMsgDatabase::PurgeMessagesOlderThan(PRUint32 daysToKeepHdrs,
{ {
PRTime date; PRTime date;
pHeader->GetDate(&date); pHeader->GetDate(&date);
if (LL_CMP(date, <, cutOffDay)) if (date < cutOffDay)
purgeHdr = true; purgeHdr = true;
} }
if (purgeHdr) if (purgeHdr)

Просмотреть файл

@ -42,7 +42,7 @@ void nsMsgHdr::Init()
m_statusOffset = 0xffffffff; m_statusOffset = 0xffffffff;
m_messageKey = nsMsgKey_None; m_messageKey = nsMsgKey_None;
m_messageSize = 0; m_messageSize = 0;
m_date = LL_ZERO; m_date = 0;
m_flags = 0; m_flags = 0;
m_mdbRow = NULL; m_mdbRow = NULL;
m_threadId = nsMsgKey_None; m_threadId = nsMsgKey_None;

Просмотреть файл

@ -329,7 +329,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
PRTime curHdrDate; PRTime curHdrDate;
curHdr->GetDate(&curHdrDate); curHdr->GetDate(&curHdrDate);
if (LL_CMP(newHdrDate, <, curHdrDate)) if (newHdrDate < curHdrDate)
moveIndex = childIndex; moveIndex = childIndex;
} }
} }
@ -348,7 +348,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, nsIMsgDBHdr *inReplyTo,
if (NS_SUCCEEDED(rv) && topLevelHdr) if (NS_SUCCEEDED(rv) && topLevelHdr)
{ {
topLevelHdr->GetDate(&topLevelHdrDate); topLevelHdr->GetDate(&topLevelHdrDate);
if (LL_CMP(newHdrDate, <, topLevelHdrDate)) if (newHdrDate < topLevelHdrDate)
{ {
RerootThread(child, topLevelHdr, announcer); RerootThread(child, topLevelHdr, announcer);
mdb_pos outPos; mdb_pos outPos;

Просмотреть файл

@ -87,9 +87,7 @@ GenerateGlobalRandomBytes(unsigned char *buf, PRInt32 len)
{ {
// Seed the random-number generator with current time so that // Seed the random-number generator with current time so that
// the numbers will be different every time we run. // the numbers will be different every time we run.
PRInt32 aTime; srand( (unsigned)PR_Now() );
LL_L2I(aTime, PR_Now());
srand( (unsigned)aTime );
firstTime = false; firstTime = false;
} }

Просмотреть файл

@ -662,18 +662,11 @@ nsImapIncomingServer::ConnectionTimeOut(nsIImapProtocol* aConnection)
SetTimeOutLimits(timeoutInMinutes); SetTimeOutLimits(timeoutInMinutes);
} }
PRTime cacheTimeoutLimits; PRTime cacheTimeoutLimits = timeoutInMinutes * 60 * PR_USEC_PER_SEC;
LL_I2L(cacheTimeoutLimits, timeoutInMinutes * 60 * 1000000); // in
// microseconds
PRTime lastActiveTimeStamp; PRTime lastActiveTimeStamp;
rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp); rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp);
PRTime elapsedTime; if (PR_Now() - lastActiveTimeStamp < cacheTimeoutLimits)
LL_SUB(elapsedTime, PR_Now(), lastActiveTimeStamp);
PRTime t;
LL_SUB(t, elapsedTime, cacheTimeoutLimits);
if (LL_GE_ZERO(t))
{ {
nsCOMPtr<nsIImapProtocol> aProtocol(do_QueryInterface(aConnection, nsCOMPtr<nsIImapProtocol> aProtocol(do_QueryInterface(aConnection,
&rv)); &rv));

Просмотреть файл

@ -411,10 +411,10 @@ nsImapProtocol::nsImapProtocol() : nsMsgProtocol(nsnull),
m_nextUrlReadyToRun = false; m_nextUrlReadyToRun = false;
m_trackingTime = false; m_trackingTime = false;
m_curFetchSize = 0; m_curFetchSize = 0;
LL_I2L(m_startTime, 0); m_startTime = 0;
LL_I2L(m_endTime, 0); m_endTime = 0;
LL_I2L(m_lastActiveTime, 0); m_lastActiveTime = 0;
LL_I2L(m_lastProgressTime, 0); m_lastProgressTime = 0;
ResetProgressInfo(); ResetProgressInfo();
m_tooFastTime = 0; m_tooFastTime = 0;
@ -3079,12 +3079,8 @@ nsImapProtocol::GetArbitraryHeadersToDownload(nsCString &aResult)
void void
nsImapProtocol::AdjustChunkSize() nsImapProtocol::AdjustChunkSize()
{ {
PRTime deltaTime;
PRInt32 deltaInSeconds; PRInt32 deltaInSeconds;
PRTime2Seconds(m_endTime - m_startTime, &deltaInSeconds);
m_endTime = PR_Now();
LL_SUB(deltaTime, m_endTime, m_startTime);
PRTime2Seconds(deltaTime, &deltaInSeconds);
m_trackingTime = false; m_trackingTime = false;
if (deltaInSeconds < 0) if (deltaInSeconds < 0)
return; // bogus for some reason return; // bogus for some reason
@ -4999,7 +4995,7 @@ nsImapProtocol::AlertUserEventFromServer(const char * aServerEvent)
void nsImapProtocol::ResetProgressInfo() void nsImapProtocol::ResetProgressInfo()
{ {
LL_I2L(m_lastProgressTime, 0); m_lastProgressTime = 0;
m_lastPercent = -1; m_lastPercent = -1;
m_lastProgressStringId = (PRUint32) -1; m_lastProgressStringId = (PRUint32) -1;
} }
@ -5062,21 +5058,15 @@ nsImapProtocol::ProgressEventFunctionUsingIdWithString(PRUint32 aMsgId, const
void void
nsImapProtocol::PercentProgressUpdateEvent(PRUnichar *message, PRInt64 currentProgress, PRInt64 maxProgress) nsImapProtocol::PercentProgressUpdateEvent(PRUnichar *message, PRInt64 currentProgress, PRInt64 maxProgress)
{ {
PRInt64 nowMS = LL_ZERO; PRInt64 nowMS = 0;
PRInt32 percent = (100 * currentProgress) / maxProgress; PRInt32 percent = (100 * currentProgress) / maxProgress;
if (percent == m_lastPercent) if (percent == m_lastPercent)
return; // hasn't changed, right? So just return. Do we need to clear this anywhere? return; // hasn't changed, right? So just return. Do we need to clear this anywhere?
if (percent < 100) // always need to do 100% if (percent < 100) // always need to do 100%
{ {
int64 minIntervalBetweenProgress; nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
if (nowMS - m_lastProgressTime < 750)
LL_I2L(minIntervalBetweenProgress, 750);
int64 diffSinceLastProgress;
LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
LL_SUB(diffSinceLastProgress, nowMS, m_lastProgressTime); // r = a - b
LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b
if (!LL_GE_ZERO(diffSinceLastProgress))
return; return;
} }
@ -8481,8 +8471,7 @@ bool nsImapProtocol::CheckNeeded()
PRTime deltaTime; PRTime deltaTime;
PRInt32 deltaInSeconds; PRInt32 deltaInSeconds;
LL_SUB(deltaTime, PR_Now(), m_lastCheckTime); PRTime2Seconds(PR_Now() - m_lastCheckTime, &deltaInSeconds);
PRTime2Seconds(deltaTime, &deltaInSeconds);
return (deltaInSeconds >= kMaxSecondsBeforeCheck); return (deltaInSeconds >= kMaxSecondsBeforeCheck);
} }

Просмотреть файл

@ -75,6 +75,7 @@
nsLocalMailCopyState::nsLocalMailCopyState() : nsLocalMailCopyState::nsLocalMailCopyState() :
m_flags(0), m_flags(0),
m_lastProgressTime(PR_IntervalToMilliseconds(PR_IntervalNow())),
m_curDstKey(0xffffffff), m_curDstKey(0xffffffff),
m_curCopyIndex(0), m_curCopyIndex(0),
m_totalMsgCount(0), m_totalMsgCount(0),
@ -86,7 +87,6 @@ nsLocalMailCopyState::nsLocalMailCopyState() :
m_writeFailed(false), m_writeFailed(false),
m_notifyFolderLoaded(false) m_notifyFolderLoaded(false)
{ {
LL_I2L(m_lastProgressTime, PR_IntervalToMilliseconds(PR_IntervalNow()));
} }
nsLocalMailCopyState::~nsLocalMailCopyState() nsLocalMailCopyState::~nsLocalMailCopyState()
@ -3187,16 +3187,11 @@ nsresult nsMsgLocalMailFolder::DisplayMoveCopyStatusMsg()
const PRUnichar * stringArray[] = { numMsgSoFarString.get(), totalMessagesString.get(), folderName.get() }; const PRUnichar * stringArray[] = { numMsgSoFarString.get(), totalMessagesString.get(), folderName.get() };
rv = mCopyState->m_stringBundle->FormatStringFromID(statusMsgId, stringArray, 3, rv = mCopyState->m_stringBundle->FormatStringFromID(statusMsgId, stringArray, 3,
getter_Copies(finalString)); getter_Copies(finalString));
PRInt64 minIntervalBetweenProgress; PRInt64 nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
PRInt64 nowMS = LL_ZERO;
// only update status/progress every half second // only update status/progress every half second
LL_I2L(minIntervalBetweenProgress, 500); if (nowMS - mCopyState->m_lastProgressTime < 500 &&
PRInt64 diffSinceLastProgress; mCopyState->m_curCopyIndex < mCopyState->m_totalMsgCount)
LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
LL_SUB(diffSinceLastProgress, nowMS, mCopyState->m_lastProgressTime); // r = a - b
LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b
if (!LL_GE_ZERO(diffSinceLastProgress) && mCopyState->m_curCopyIndex < mCopyState->m_totalMsgCount)
return NS_OK; return NS_OK;
mCopyState->m_lastProgressTime = nowMS; mCopyState->m_lastProgressTime = nowMS;

Просмотреть файл

@ -600,7 +600,7 @@ NS_IMETHODIMP nsParseMailMessageState::Clear()
ClearAggregateHeader (m_ccList); ClearAggregateHeader (m_ccList);
m_headers.ResetWritePos(); m_headers.ResetWritePos();
m_envelope.ResetWritePos(); m_envelope.ResetWritePos();
m_receivedTime = LL_ZERO; m_receivedTime = 0;
for (PRUint32 i = 0; i < m_customDBHeaders.Length(); i++) for (PRUint32 i = 0; i < m_customDBHeaders.Length(); i++)
m_customDBHeaderValues[i].length = 0; m_customDBHeaderValues[i].length = 0;
@ -1118,7 +1118,7 @@ SEARCH_NEWLINE:
while (header->length > 0 && while (header->length > 0 &&
IS_SPACE (header->value [header->length - 1])) IS_SPACE (header->value [header->length - 1]))
((char *) header->value) [--header->length] = 0; ((char *) header->value) [--header->length] = 0;
if (header == &receivedBy && LL_IS_ZERO(m_receivedTime)) if (header == &receivedBy && m_receivedTime == 0)
{ {
// parse Received: header for date. // parse Received: header for date.
// We trust the first header as that is closest to recipient, // We trust the first header as that is closest to recipient,
@ -1580,7 +1580,7 @@ int nsParseMailMessageState::FinalizeHeaders()
PRTime resultTime = PR_Now(); PRTime resultTime = PR_Now();
m_newMsgHdr->SetDate(resultTime); m_newMsgHdr->SetDate(resultTime);
} }
if (!LL_IS_ZERO(m_receivedTime)) if (m_receivedTime != 0)
{ // Upgrade 'Received' to Received: ? { // Upgrade 'Received' to Received: ?
PRTime2Seconds(m_receivedTime, &rcvTimeSecs); PRTime2Seconds(m_receivedTime, &rcvTimeSecs);
} }

Просмотреть файл

@ -63,13 +63,7 @@ net_pop3_remove_messages_marked_delete(PLHashEntry* he,
PRUint32 TimeInSecondsFromPRTime(PRTime prTime) PRUint32 TimeInSecondsFromPRTime(PRTime prTime)
{ {
PRUint32 retTimeInSeconds; return (PRUint32)(prTime / PR_USEC_PER_SEC);
PRInt64 microSecondsPerSecond, intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_DIV(intermediateResult, prTime, microSecondsPerSecond);
LL_L2UI(retTimeInSeconds, intermediateResult);
return retTimeInSeconds;
} }
static void static void
@ -2973,7 +2967,7 @@ PRInt32 nsPop3Protocol::GetMsg()
if (m_totalDownloadSize > 0) // skip all this if there aren't any messages if (m_totalDownloadSize > 0) // skip all this if there aren't any messages
{ {
nsresult rv; nsresult rv;
PRInt64 mailboxSpaceLeft = LL_Zero(); PRInt64 mailboxSpaceLeft = 0;
nsCOMPtr <nsIMsgFolder> folder; nsCOMPtr <nsIMsgFolder> folder;
nsCOMPtr <nsIFile> path; nsCOMPtr <nsIFile> path;
@ -3015,14 +3009,7 @@ PRInt32 nsPop3Protocol::GetMsg()
* etc. The space "available" may be greater than the actual space * etc. The space "available" may be greater than the actual space
* usable. */ * usable. */
PRInt64 llResult; if (m_totalDownloadSize + PRInt64(EXTRA_SAFETY_SPACE) > mailboxSpaceLeft)
PRInt64 llExtraSafetySpace;
PRInt64 llTotalDownloadSize;
LL_I2L(llExtraSafetySpace, EXTRA_SAFETY_SPACE);
LL_I2L(llTotalDownloadSize, m_totalDownloadSize);
LL_ADD(llResult, llTotalDownloadSize, llExtraSafetySpace);
if (LL_CMP(llResult, >, mailboxSpaceLeft))
{ {
// Not enough disk space! // Not enough disk space!
#ifdef DEBUG #ifdef DEBUG

Просмотреть файл

@ -73,6 +73,7 @@ nsNNTPNewsgroupList::nsNNTPNewsgroupList()
m_downloadAll(false), m_downloadAll(false),
m_maxArticles(0), m_maxArticles(0),
m_lastPercent(-1), m_lastPercent(-1),
m_lastStatusUpdate(0),
m_lastProcessedNumber(0), m_lastProcessedNumber(0),
m_firstMsgNumber(0), m_firstMsgNumber(0),
m_lastMsgNumber(0), m_lastMsgNumber(0),
@ -81,7 +82,6 @@ nsNNTPNewsgroupList::nsNNTPNewsgroupList()
m_set(nsnull) m_set(nsnull)
{ {
memset(&m_knownArts, 0, sizeof(m_knownArts)); memset(&m_knownArts, 0, sizeof(m_knownArts));
m_lastStatusUpdate = LL_Zero();
} }
nsNNTPNewsgroupList::~nsNNTPNewsgroupList() nsNNTPNewsgroupList::~nsNNTPNewsgroupList()

Просмотреть файл

@ -292,7 +292,7 @@ nsNNTPProtocol::nsNNTPProtocol(nsINntpIncomingServer *aServer, nsIURI *aURL,
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) creating",this)); PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) creating",this));
PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) initializing, so unset m_currentGroup",this)); PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) initializing, so unset m_currentGroup",this));
m_currentGroup.Truncate(); m_currentGroup.Truncate();
LL_I2L(m_lastActiveTimeStamp, 0); m_lastActiveTimeStamp = 0;
} }
nsNNTPProtocol::~nsNNTPProtocol() nsNNTPProtocol::~nsNNTPProtocol()
@ -1764,10 +1764,7 @@ PRInt32 nsNNTPProtocol::SendFirstNNTPCommand(nsIURI * url)
{ {
char small_buf[64]; char small_buf[64];
PRExplodedTime expandedTime; PRExplodedTime expandedTime;
PRTime t_usec, usec_per_sec; PRTime t_usec = (PRTime)last_update * PR_USEC_PER_SEC;
LL_I2L(t_usec, last_update);
LL_I2L(usec_per_sec, PR_USEC_PER_SEC);
LL_MUL(t_usec, t_usec, usec_per_sec);
PR_ExplodeTime(t_usec, PR_LocalTimeParameters, &expandedTime); PR_ExplodeTime(t_usec, PR_LocalTimeParameters, &expandedTime);
PR_FormatTimeUSEnglish(small_buf, sizeof(small_buf), PR_FormatTimeUSEnglish(small_buf, sizeof(small_buf),
"NEWGROUPS %y%m%d %H%M%S", &expandedTime); "NEWGROUPS %y%m%d %H%M%S", &expandedTime);
@ -2727,13 +2724,7 @@ static void ComputeRate(PRInt32 bytes, PRTime startTime, float *rate)
// rate = (bytes / USECS since start) * RATE_CONSTANT // rate = (bytes / USECS since start) * RATE_CONSTANT
// compute usecs since we started. // compute usecs since we started.
PRTime timeSinceStart; PRInt32 delta = (PRInt32)(PR_Now() - startTime);
PRTime now = PR_Now();
LL_SUB(timeSinceStart, now, startTime);
// convert PRTime to PRInt32
PRInt32 delta;
LL_L2I(delta, timeSinceStart);
// compute rate // compute rate
if (delta > 0) { if (delta > 0) {

Просмотреть файл

@ -62,7 +62,7 @@ nsNewsDownloader::nsNewsDownloader(nsIMsgWindow *window, nsIMsgDatabase *msgDB,
m_listener = listener; m_listener = listener;
m_window = window; m_window = window;
m_lastPercent = -1; m_lastPercent = -1;
LL_I2L(m_lastProgressTime, 0); m_lastProgressTime = 0;
// not the perfect place for this, but I think it will work. // not the perfect place for this, but I think it will work.
if (m_window) if (m_window)
m_window->SetStopped(false); m_window->SetStopped(false);
@ -168,17 +168,11 @@ bool nsNewsDownloader::GetNextHdrToRetrieve()
PRInt32 percent; PRInt32 percent;
percent = (100 * m_numwrote) / (PRInt32) m_keysToDownload.Length(); percent = (100 * m_numwrote) / (PRInt32) m_keysToDownload.Length();
PRInt64 nowMS = LL_ZERO; PRInt64 nowMS = 0;
if (percent < 100) // always need to do 100% if (percent < 100) // always need to do 100%
{ {
int64 minIntervalBetweenProgress; nowMS = PR_IntervalToMilliseconds(PR_IntervalNow());
if (nowMS - m_lastProgressTime < 750)
LL_I2L(minIntervalBetweenProgress, 750);
int64 diffSinceLastProgress;
LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
LL_SUB(diffSinceLastProgress, nowMS, m_lastProgressTime); // r = a - b
LL_SUB(diffSinceLastProgress, diffSinceLastProgress, minIntervalBetweenProgress); // r = a - b
if (!LL_GE_ZERO(diffSinceLastProgress))
return true; return true;
} }

Просмотреть файл

@ -452,17 +452,10 @@ nsNntpIncomingServer::ConnectionTimeOut(nsINNTPProtocol* aConnection)
if (!aConnection) return retVal; if (!aConnection) return retVal;
nsresult rv; nsresult rv;
PRTime cacheTimeoutLimits;
LL_I2L(cacheTimeoutLimits, 170 * 1000000); // 170 seconds in microseconds
PRTime lastActiveTimeStamp; PRTime lastActiveTimeStamp;
rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp); rv = aConnection->GetLastActiveTimeStamp(&lastActiveTimeStamp);
PRTime elapsedTime; if (PR_Now() - lastActiveTimeStamp >= PRTime(170) * PR_USEC_PER_SEC)
LL_SUB(elapsedTime, PR_Now(), lastActiveTimeStamp);
PRTime t;
LL_SUB(t, elapsedTime, cacheTimeoutLimits);
if (LL_GE_ZERO(t))
{ {
#ifdef DEBUG_seth #ifdef DEBUG_seth
printf("XXX connection timed out, close it, and remove it from the connection cache\n"); printf("XXX connection timed out, close it, and remove it from the connection cache\n");
@ -790,9 +783,7 @@ nsNntpIncomingServer::WriteHostInfoFile()
{ {
if (!mHostInfoHasChanged) if (!mHostInfoHasChanged)
return NS_OK; return NS_OK;
PRInt32 firstnewdate; PRInt32 firstnewdate = (PRInt32)mFirstNewDate;
LL_L2I(firstnewdate, mFirstNewDate);
mLastUpdatedTime = PRUint32(PR_Now() / PR_USEC_PER_SEC); mLastUpdatedTime = PRUint32(PR_Now() / PR_USEC_PER_SEC);
@ -1243,8 +1234,7 @@ nsNntpIncomingServer::HandleLine(const char* line, PRUint32 line_size)
if (PL_strcmp(line, "lastgroupdate") == 0) { if (PL_strcmp(line, "lastgroupdate") == 0) {
mLastUpdatedTime = strtoul(equalPos, nsnull, 10); mLastUpdatedTime = strtoul(equalPos, nsnull, 10);
} else if (PL_strcmp(line, "firstnewdate") == 0) { } else if (PL_strcmp(line, "firstnewdate") == 0) {
PRInt32 firstnewdate = strtol(equalPos, nsnull, 16); mFirstNewDate = strtol(equalPos, nsnull, 16);
LL_I2L(mFirstNewDate, firstnewdate);
} else if (PL_strcmp(line, "uniqueid") == 0) { } else if (PL_strcmp(line, "uniqueid") == 0) {
mUniqueId = strtol(equalPos, nsnull, 16); mUniqueId = strtol(equalPos, nsnull, 16);
} else if (PL_strcmp(line, "version") == 0) { } else if (PL_strcmp(line, "version") == 0) {