Проще.

Код:
PROGRAM PLC_PRG
VAR
	d, t: TIME;
END_VAR

d := TIME() - t;
t := TIME();