Important Update:
- FunctionCore: - Bug Fix: Change Channel OutState before triggering event - TimingCore: - Add method SecondsPassed() (provides seconds instead of milli-seconds)
This commit is contained in:
14
TimingCore.h
14
TimingCore.h
@@ -53,6 +53,16 @@ inline long TimePassed( timeval StartTime ) {
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
inline long SecondsPassed( timeval StartTime ) {
|
||||
timeval CurrTime;
|
||||
long Duration;
|
||||
|
||||
gettimeofday( &CurrTime, NULL );
|
||||
Duration = CurrTime.tv_sec - StartTime.tv_sec;
|
||||
return Duration;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Time remaining from Start time to given time out
|
||||
inline long TimeLeft( timeval StartTime, long MilliSeconds ) {
|
||||
return (MilliSeconds - TimePassed(StartTime));
|
||||
@@ -69,11 +79,9 @@ inline bool Timeout( timeval StartTime, long MilliSeconds ) {
|
||||
inline long GetUpCounter( timeval StartTime, char * TextStr ) {
|
||||
long Duration;
|
||||
int Days, Hours, Minutes, Seconds;
|
||||
timeval CurrTime;
|
||||
|
||||
// Get duration
|
||||
gettimeofday( &CurrTime, NULL );
|
||||
Duration = (!StartTime.tv_sec)? 0 : (CurrTime.tv_sec - StartTime.tv_sec); // Handle zero start
|
||||
Duration = SecondsPassed( StartTime );
|
||||
|
||||
// Create string
|
||||
if (TextStr) {
|
||||
|
||||
Reference in New Issue
Block a user