Rolling 24h accumulating measurement


I have an electric motor that starts and stops every now and then. many times per day.

I log the the starts and stops and measure the run-time of the motor.

I would like to present how long the motor has been running in total, for the last 24 hours, at any given time. For instance, if I check the log right now, I would like to now how long time the auger has been running since the same time yesterday. If I check it in 1.5 hours again, it should be the same (but 1.5 hours later)

Any suggestions on how to implement this?
I am thinking I am not the first to do this, so there might be code for it somewhere :slight_smile:

The application is a house heating system with a pellet boiler, where I measure the run time of the auger feeding the pellet burner with pellets. I am running an ESP8266 hooked up to the burner and feeding a webpage via wifi/internet with stats from the burner.

Number of seconds since midnight.
Simple timestamp.

where do you log the data and what timeline do you use to remember the starts and stops moments ? do you have an RTC ? (and do you keep start time and duration or start time and stop time?)