← All exercises

Run Hours

medium

Totals a machine's run time as hours, minutes, and seconds, retaining the total through stops, with a manual reset.

What it teaches

The real hour meter: run one retentive timer continuously and bank a second each time its accumulator passes a moving 1000 ms target, then cascade the rollovers — seconds into minutes, minutes into hours. Self-resetting timers lose a little time at every rollover on real controllers; the free-running meter with a moving target is the drift-free production pattern.

Inputs and outputs

TagTypeDefaultDescription
In_RunBOOLSignal to track run time
In_ResetBOOLClears the accumulated total
Out_SecondsDINTSeconds portion of the total, 0-59
Out_MinutesDINTMinutes portion of the total, 0-59
Out_HoursDINTWhole hours of accumulated run time

Required behavior