Thinking about sumations

I was able to do this with a memory tag and a client tag. The memory tag would be the boolean for the motor on/off, the client tag would be your runtime. And this is the expression that I put on the client tag:

if({Memtag}, dateDiff(toDate({Memtag.LastChange}), toDate(now()), "minute"), 0)