From 630583bbc6d049c62051db8948d2f7ced8f379fb Mon Sep 17 00:00:00 2001 From: Charl Wentzel Date: Thu, 2 Jun 2016 09:36:08 +0200 Subject: [PATCH] Minor Update: - BufferCore: Set BufSize as class constant - TimingCore: Add new function Timeout() --- BufferCore.h | 4 ++-- TimingCore.cpp | 6 ++++++ TimingCore.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/BufferCore.h b/BufferCore.h index c399fbe..e4c73e9 100644 --- a/BufferCore.h +++ b/BufferCore.h @@ -20,8 +20,8 @@ class CBuffer { private: // Buffer Definition - char * Buffer; // Memory allocated to buffer - int BufSize; // Size of allocated buffer + char * Buffer; // Memory allocated to buffer + const int BufSize; // Size of allocated buffer // Buffer pointers int BufStart; // First unread characters on buffer diff --git a/TimingCore.cpp b/TimingCore.cpp index dbc791b..b0808db 100644 --- a/TimingCore.cpp +++ b/TimingCore.cpp @@ -49,3 +49,9 @@ long TimePassed( timeval StartTime ) return Duration; } //--------------------------------------------------------------------------- + +bool Timeout( timeval StartTime, long MilliSeconds ) +{ + return ((TimePassed(StartTime) > MilliSeconds)? true : false); +} +//--------------------------------------------------------------------------- diff --git a/TimingCore.h b/TimingCore.h index bd2fe31..003c297 100644 --- a/TimingCore.h +++ b/TimingCore.h @@ -19,6 +19,7 @@ void SetInterval( timeval *Time, long MilliSeconds ); void SetStartTime( timeval *StartTime ); long TimePassed( timeval StartTime ); +bool Timeout( timeval StartTime, long MilliSeconds ); //---------------------------------------------------------------------------