Bug 1207478: P1. Prevent microseconds calculation overflow. r=gerald

This leaves us safe until year 294441 (assuming unix timestamp).
This commit is contained in:
Jean-Yves Avenard 2015-09-24 09:29:54 +10:00
Родитель 64c0a617b7
Коммит 7d65b942c5
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -35,7 +35,9 @@ public:
Microseconds ToMicroseconds(int64_t aTimescaleUnits)
{
return aTimescaleUnits * 1000000ll / mTimescale;
int64_t major = aTimescaleUnits / mTimescale;
int64_t remainder = aTimescaleUnits % mTimescale;
return major * 1000000ll + remainder * 1000000ll / mTimescale;
}
uint64_t mCreationTime;