Sometimes it is necessary to know the total duration for which a load has been switched on. A timer can be used to determine how long it has been since the load was last switched on, but to cope with the load going on and off, a little more code is required. In the code below, the accumulated time for which the "Kitchen 1" light has been on is displayed on the screen. Timer number 1 records how long it has been since the load was last switched on. The AccumulatedTime variable stores how long the load was on previously. The sum of these two is the total on time. Note that when the Timer is not running, its value will be -1 which will make the total one second lower than it should be. If you can't live with this, you need to check whether the timer is running or not, as shown in the code below. [code] { var section } AccumulatedTime : integer; { initialisation section } AccumulatedTime := 0; { module } once GetLightingState("Kitchen 1") = ON then TimerStart(1); once GetLightingState("Kitchen 1") = OFF then begin AccumulatedTime := AccumulatedTime + TimerTime(1); TimerStop(1); end; { display accumulated time on screen } ClearScreen; TextPos(300, 100); if TimerRunning(1) then DrawText(AccumulatedTime + TimerTime(1)) else DrawText(AccumulatedTime); [/code] Note that if you are using a PAC, the timers only go up to 9 hours, so the code may been to be written differently.