Surely all you need to do is record the time (from the real time clock or from millis()) whenever the switch is thrown?
...R