1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-21 01:24:21 +00:00

Major change to the way the Image class works, making it use value semantics and internally shared data (see the forum notes for more info on this). Also minor changes to win32 browser plugin object ref counting and linux millisecond timers.

This commit is contained in:
Julian Storer 2010-06-01 18:01:13 +01:00
parent 1baaa016bd
commit 24673283eb
121 changed files with 2763 additions and 2930 deletions

View file

@ -133,44 +133,43 @@ void PlatformUtilities::fpuReset()
}
//==============================================================================
uint32 juce_millisecondsSinceStartup() throw()
static bool juce_getTimeSinceStartup (timeval* const t) throw()
{
if (gettimeofday (t, 0) != 0)
return false;
static unsigned int calibrate = 0;
static bool calibrated = false;
timeval t;
unsigned int ret = 0;
if (! gettimeofday (&t, 0))
if (! calibrated)
{
if (! calibrated)
{
struct sysinfo sysi;
calibrated = true;
if (sysinfo (&sysi) == 0)
// Safe to assume system was not brought up earlier than 1970!
calibrate = t.tv_sec - sysi.uptime;
calibrated = true;
}
ret = 1000 * (t.tv_sec - calibrate) + (t.tv_usec / 1000);
struct sysinfo sysi;
if (sysinfo (&sysi) == 0)
calibrate = t->tv_sec - sysi.uptime; // Safe to assume system was not brought up earlier than 1970!
}
return ret;
t->tv_sec -= calibrate;
return true;
}
double Time::getMillisecondCounterHiRes() throw()
uint32 juce_millisecondsSinceStartup() throw()
{
return getHighResolutionTicks() * 0.001;
timeval t;
if (juce_getTimeSinceStartup (&t))
return (uint32) (t.tv_sec * 1000 + (t.tv_usec / 1000));
return 0;
}
int64 Time::getHighResolutionTicks() throw()
{
timeval t;
if (gettimeofday (&t, 0))
return 0;
if (juce_getTimeSinceStartup (&t))
return ((int64) t.tv_sec * (int64) 1000000) + (int64) t.tv_usec;
return ((int64) t.tv_sec * (int64) 1000000) + (int64) t.tv_usec;
return 0;
}
int64 Time::getHighResolutionTicksPerSecond() throw()
@ -178,6 +177,11 @@ int64 Time::getHighResolutionTicksPerSecond() throw()
return 1000000; // (microseconds)
}
double Time::getMillisecondCounterHiRes() throw()
{
return getHighResolutionTicks() * 0.001;
}
bool Time::setSystemTimeToThisTime() const
{
timeval t;