Important Update:

- CItemBuffer:
  - Rename CItemBufferCore -> CItemBuffer
  - Add item count and GetCount() method
  - Bug fix: Reset LastItem on DeleteAll()
- TimingCore:
  - Bug fix: Handle buffer overflow on 32-bit processors
This commit is contained in:
Charl Wentzel
2017-08-17 10:56:10 +02:00
parent 2b7c49d5bb
commit 8fd04dc9e2
3 changed files with 30 additions and 20 deletions

View File

@@ -7,6 +7,7 @@
// Standard C/C++ Libraries
#include <time.h>
#include <limits.h>
// redA Libraries
#include "TimingCore.h"
@@ -43,15 +44,17 @@ void ClearStartTime( timeval * StartTime )
// Calculate TimePassed from Start Time (in milli-seconds)
long TimePassed( timeval StartTime )
{
timeval CurrTime;
long Duration;
timeval CurrTime;
long Duration;
// Get current time
gettimeofday( &CurrTime, NULL );
// Get time passed in milli-seconds
Duration = (CurrTime.tv_sec - StartTime.tv_sec) * 1000 +
(CurrTime.tv_usec - StartTime.tv_usec) / 1000;
Duration = (CurrTime.tv_sec - StartTime.tv_sec) * (time_t)1000 +
(CurrTime.tv_usec - StartTime.tv_usec) / (time_t)1000;
if (Duration < 0)
Duration = LONG_MAX;
return Duration;
}