Need help on light detection sensor

With a RTC there is no need to use the LDR to detect light.

With this library, SolarCalculator library for Arduino and your lat and long, and a RTC, when its light and not light can be calculated.