Electrical Device Up-time
First, the current sensors. You don't even need to tap into the wires - a properly chosen coil placed next to a "live" mains wire (say, taped to the supply cable) with AC will have current induced in it if considerable (typical for running appliances) current flows through the wire. The values are well within readout range of common ADC inputs, making callibrating the input for "active/inactive" easy. 

It's possible without ADC, using, say, a diode for a rectifier, a Schmidtt trigger to produce binary signal, and a potentiometer to tune the "active/passive" levels - about 3-4 extra parts per input on top of the coil, but currently microcontrollers with multiple ADC inputs are ubiquitous and you do need a microcontroller anyway; doing the readout/filtering in software will be easier.

Every microcontroller has a clock, so no problem here. You'd need an RTC if you want actual hours and not just durations, and your microcontroller will need a battery/capacitor backup (because almost certainly if the devices lose power, so does the microcontroller). It may not require exceptionally long sustained power - upon detecting input power loss, it can just record the measurements to the database in flash, and go to sleep, to be woken up when power returns. 

You didn't write where the database is to reside, how it's accessed and how many devices are to be monitored - these are all factors in selecting the controller - anything between a simple 8-bit PIC, and an SBC like Raspberry Pi. The hardware part doesn't change though. Input from the coil provides a sine wave (possibly with bottom half cut off), or next to nothing; sum measurements over a period of say, 0.1s, if they are over the threshold, device is active.



One thing you wrote might be a problem: you plan to measure uptime of refrigerators. Refrigerators draw their nominal current when the aggregate is active, and performs cooling below the temperature set on the thermostat. Then the thermostat switches the aggregate off, and the refrigerator enters "idle" mode, until the temperature rises over the thermostat hysteresis threshold and it switches on. All refrigerators draw next to no current during the idle phase - about all older ones, and many new (without digital electronics) literally draw a flat zero, completely indistinguishable from the refrigerator being switched off from electrical point of view. This may pose a problem in your case.