Solution and sketch for detecting 12v dc presence to log usage in hrs and min

I'm looking for a solution where we can log in hours and minutes when 12v is detected. I want to log the usage of the machine in hours and minutes.

You may want to consider using a voltage divider or regulator and polling a connected GPIO pin.

I assume when it drops out - it’s gone (0V).

… or are you looking for the schematic and sketch?


What do you want to do that is different from this: ?

Are you logging to SD card or a PC or do you just want to display the time the machine has been running. Do you need a resettable counter or must the time log be permanent?