SLC has an instruction, I think it's RHC for Read High-speed Clock. It will put the current value of a 20-bit 100kHz clock counter into a REAL, so that will repeat every 10.48576s = 1,048,576 (= 2**20) ticks of the clock. So if you use RHC to put the current value into a REAL on each scan, and save the REAL value from the previous scan, the current value will be less than the previous value for one scan every 10s+, so the sequence is
...
RHC current_rhc
LES current_rhc previous_rhc OTE trigger
MOV current_rhc previous_rhc
...
and you can use that trigger as a one shot to decide when to increment one the INT counters MACHINE_IS_RUNNING or MACHINE_IS_IN_MAINTENANCE, and at any time multiplying either of those counters by 10.48576s or (10.48678/60) (10.48678/3600) will give the seconds or minutes or hours the machine has been in each state.
Or the counters could be REALs and you add 10.48576 or (10.48576/60) or (10.48576/3600) to have the desired units directly available.
Or you could use an STI task that runs every 1000ms, or a repeating timer, whatever works to get that regular one-shot.
Or you could skip any attempt at triggering a timed event, and simply count the number of scans the machine is in each state, and assume the average scan is of a constant length; converting to an absolute time would be problematic, but the relative fraction of time the machine is in each state is trivial.
That is probably straightforward; the messy part will probably be the logic that resets the counters at the start of each shift, as well as any logic to save previous shifts' data.