You do not specify how you want to recover/read the on / off time. Of course the easiest way is to track the on/off events on an mqtt topic. You don’t need to change anything in tasmota or make any rules for this.
Assuming you want to store the on/off time in tasmota you could do this
Rule1 on power1#state=1 do var1 %time% endon on power1#state=0 do var2 %time% endon
NB vars do not persist through reboots. If you need persistence you could use mem but be aware that this will wear down your eeprom quickly. You are better advised to use an mqtt listener in this instance.