kindly help

I have to position a lightsource at the center of the sphere (the sphere represents the sun), this is a positional light source,
thus from the sun there is a spot light that
falls on the ground with a certain cutoff angle, when this happens it is the day, i have to show the night by showing the gradual fading of the light and the movement of the sun from east to west (sunset) thru
rotation.I think i would have to use the gluttimerfunc for this objective,
i will appreciate if someone can help, if possible illustrate via a snippet of code
thank you