Light sensing with a Raspberry Pi

In a project I wanted to measure the amount of light in the room for controlling the backlight of a Tft display. The project uses a Raspberry Pi, which sadly don't have any analog inputs. In this case one can use a Ldr or a photo transistor with a capacitor. The principle is that you set a pin as output and make it high. This charges the capacitor. You then set the pin as input and measure the time until the Pi consideres the input to be low. The time this takes depends on how much light the detector is exposed to and will be a value depending on how much light there is in the room.
This was inspired by the LDR-based Pi project here and the one with a photo transistor and an Arduino here.
The circuit is simple. A capacitor (2.2uF) is connected in parallell with the photo transistor, which E-pin is connected to ground. The C-pin is connected to the Pi:s Gpio pin 7 (BCM Gpio4) via a 220 ohm resistor.