odometer:
Take care that your odometer does not "roll over".
Also, is it possible for "step-change" to go directly from 1 to 3, or from 3 to 1?
Besides, if you have a real-time clock, why are you using millis() to measure durations?
the weather this year has not offered a trial of the furnace.
currently
the oil burner starts and runs for about 4 minutes 2.5 amps
the fan comes on runs with the burner 6.5 amps
the burner shuts off and the fan continues 3.5 amps
I expect in cold, the fan could be running and the burner comes on again.
but I just look at the amps,
if it is less than 2, then I have a variable that shows condition 0
between 2 and 3, condition 1
between 3 and 4, condition 2
over 5 amps, condition 3
if the current condition is not the same as the last condition,
data log the time, the amps and the condition.
this works well and does not care what state it was in, only that it changed state.
what is new, is the odometer.
if condition 1 or 3, that means the oil burner is running.
new flag, burnerRunning = 1
now, if that changes state, I log the time.
if it enters that state, I note the time.
==============================
why millis() ?
easier to use millis() that to call the RTC
always have short runs of less than 10 minutes so cumulative errors will not be horrible.
also, I ran this in free mode, continuous scans, continuous logging. the RTC lost time.
it appears that the RTC can loose time if you call it too frequently, or if the call is not completed within an allotted time.
losing 45 seconds a day was very disconcerting ! in that search, some people posted that they call the RTC once a day, then use millis() and make an adjustment once a day.