b=560717; fix TimeStamp initialization in TimeStamp_posix; r=bsmedberg

This commit is contained in:
Vladimir Vukicevic 2010-04-26 14:26:40 -07:00
Родитель dc740985af
Коммит 88d322d93f
1 изменённых файлов: 16 добавлений и 0 удалений

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

@ -163,10 +163,25 @@ TimeDuration::Resolution()
return TimeDuration::FromTicks(sResolution);
}
struct TimeStampInitialization
{
TimeStampInitialization() {
TimeStamp::Startup();
}
~TimeStampInitialization() {
TimeStamp::Shutdown();
}
};
static TimeStampInitialization initOnce;
static PRBool gInitialized = PR_FALSE;
nsresult
TimeStamp::Startup()
{
if (gInitialized)
return NS_OK;
struct timespec dummy;
if (0 != clock_gettime(CLOCK_MONOTONIC, &dummy))
NS_RUNTIMEABORT("CLOCK_MONOTONIC is absent!");
@ -180,6 +195,7 @@ TimeStamp::Startup()
|| 10*sResolutionSigDigs > sResolution);
sResolutionSigDigs *= 10);
gInitialized = PR_TRUE;
return NS_OK;
}