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:
Charl Wentzel
2019-06-23 20:51:51 +02:00
parent 9f8f69de3f
commit 14af8390ec
2 changed files with 14 additions and 6 deletions

View File

@@ -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) {