Skip to main content

getTimePassed

Short summary​

This method returns the passed time since the timestamp was created

:return: passed time since startTime

  • Return type: LTIME

Parameters​

NameTypeCommentKind
startTimeLTIMEtimestamp startinput

Code​

Declaration​

METHOD PROTECTED getTimePassed :LTIME
VAR_INPUT
(* timestamp start *)
startTime :LTIME;
END_VAR
VAR
(* current time to calculate the passed time *)
currentTime :LTIME;
END_VAR

Implementation​

currentTime := LTIME();
IF (currentTime > startTime) THEN
getTimePassed := (currentTime - startTime);
ELSE
getTimePassed := ((THIS^.MAX_TIME - startTime) + currentTime);
END_IF