period of day function, cloudy night icon

* functionalized period of day detection
* fixed a 'bug' whereby a cloudy day icon would show when it was a
cloudy night.