getTimePassed
Short summary
This method returns the passed time since the timestamp was created
:return: passed time since startTime
- Return type:
TIME
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| startTime | TIME | timestamp start | input |
Code
Declaration
METHOD PROTECTED getTimePassed :TIME
VAR_INPUT
(* timestamp start *)
startTime :TIME;
END_VAR
VAR
(* current time to calculate the passed time *)
currentTime :TIME;
END_VAR
Implementation
currentTime := TIME();
IF (currentTime > startTime) THEN
getTimePassed := (currentTime - startTime);
ELSE
getTimePassed := ((THIS^.MAX_TIME - startTime) + currentTime);
END_IF