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

Made linux getMillisecondCounter() run monotonically. Added a new class Decibels, with some decibel conversion methods. Minor updates to AudioThumbnail and FileInputSource.

This commit is contained in:
Julian Storer 2010-12-08 18:54:17 +00:00
parent c4029bc86d
commit 897c3e1fa7
28 changed files with 396 additions and 178 deletions

View file

@ -69,27 +69,6 @@ namespace LinuxStatsHelpers
return String::empty;
}
bool getTimeSinceStartup (timeval* const t) throw()
{
if (gettimeofday (t, 0) != 0)
return false;
static unsigned int calibrate = 0;
static bool calibrated = false;
if (! calibrated)
{
calibrated = true;
struct sysinfo sysi;
if (sysinfo (&sysi) == 0)
calibrate = t->tv_sec - sysi.uptime; // Safe to assume system was not brought up earlier than 1970!
}
t->tv_sec -= calibrate;
return true;
}
}
const String SystemStats::getCpuVendor()
@ -156,20 +135,18 @@ void PlatformUtilities::fpuReset()
//==============================================================================
uint32 juce_millisecondsSinceStartup() throw()
{
timeval t;
if (LinuxStatsHelpers::getTimeSinceStartup (&t))
return (uint32) (t.tv_sec * 1000 + (t.tv_usec / 1000));
timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
return 0;
return t.tv_sec * 1000 + t.tv_nsec / 1000000;
}
int64 Time::getHighResolutionTicks() throw()
{
timeval t;
if (LinuxStatsHelpers::getTimeSinceStartup (&t))
return ((int64) t.tv_sec * (int64) 1000000) + (int64) t.tv_usec;
timespec t;
clock_gettime (CLOCK_MONOTONIC, &t);
return 0;
return (t.tv_sec * (int64) 1000000) + (t.tv_nsec / (int64) 1000);
}
int64 Time::getHighResolutionTicksPerSecond() throw()