Browse Source

Remove Time::getApproximateMillisecondCounter from water

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 6 years ago
parent
commit
358e8ede1c
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 6 additions and 21 deletions
  1. +4
    -6
      source/modules/water/misc/Time.cpp
  2. +0
    -13
      source/modules/water/misc/Time.h
  3. +2
    -2
      source/modules/water/text/StringPool.cpp

+ 4
- 6
source/modules/water/misc/Time.cpp View File

@@ -81,7 +81,11 @@ static uint32 water_millisecondsSinceStartup() noexcept
return (uint32) timeGetTime();
#else
timespec t;
# ifdef CLOCK_MONOTONIC_RAW
clock_gettime (CLOCK_MONOTONIC_RAW, &t);
# else
clock_gettime (CLOCK_MONOTONIC, &t);
# endif
return (uint32) (t.tv_sec * 1000 + t.tv_nsec / 1000000);
#endif
@@ -146,10 +150,4 @@ uint32 Time::getMillisecondCounter() noexcept
return now;
}
uint32 Time::getApproximateMillisecondCounter() noexcept
{
const uint32 t = TimeHelpers::lastMSCounterValue.get();
return t == 0 ? getMillisecondCounter() : t;
}
}

+ 0
- 13
source/modules/water/misc/Time.h View File

@@ -103,22 +103,9 @@ public:
Being a 32-bit return value, it will of course wrap back to 0 after 2^32 seconds of
uptime, so be careful to take that into account. If you need a 64-bit time, you can
use currentTimeMillis() instead.
@see getApproximateMillisecondCounter
*/
static uint32 getMillisecondCounter() noexcept;
/** Less-accurate but faster version of getMillisecondCounter().
This will return the last value that getMillisecondCounter() returned, so doesn't
need to make a system call, but is less accurate - it shouldn't be more than
100ms away from the correct time, though, so is still accurate enough for a
lot of purposes.
@see getMillisecondCounter
*/
static uint32 getApproximateMillisecondCounter() noexcept;
private:
//==============================================================================
int64 millisSinceEpoch;


+ 2
- 2
source/modules/water/text/StringPool.cpp View File

@@ -146,7 +146,7 @@ String StringPool::getPooledString (const String& newString)
void StringPool::garbageCollectIfNeeded()
{
if (strings.size() > minNumberOfStringsForGarbageCollection
&& Time::getApproximateMillisecondCounter() > lastGarbageCollectionTime + garbageCollectionInterval)
&& Time::getMillisecondCounter() > lastGarbageCollectionTime + garbageCollectionInterval)
garbageCollect();
}
@@ -158,7 +158,7 @@ void StringPool::garbageCollect()
if (strings.getReference(i).getReferenceCount() == 1)
strings.remove (i);
lastGarbageCollectionTime = Time::getApproximateMillisecondCounter();
lastGarbageCollectionTime = Time::getMillisecondCounter();
}
StringPool& StringPool::getGlobalPool() noexcept


Loading…
Cancel
Save